Skip to content

Commit 898b35d

Browse files
committed
Fix lint
1 parent ad55264 commit 898b35d

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

android/src/main/java/com/swmansion/rnscreens/AutoRemovingFragment.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ import androidx.fragment.app.Fragment
88

99
/**
1010
* This class serves as a workaround to https://github.com/software-mansion/react-native-screens/issues/17.
11-
*
12-
* This fragment, when attached to the fragment manager & its state is progressed
13-
* to `ON_CREATED`, attempts to detach itself from the parent fragment manager
11+
*
12+
* This fragment, when attached to the fragment manager & its state is progressed
13+
* to `ON_CREATED`, attempts to detach itself from the parent fragment manager
1414
* as soon as possible.
15-
*
16-
* Instances of this type should be created in place of regular screen fragments
15+
*
16+
* Instances of this type should be created in place of regular screen fragments
1717
* when Android restores fragments after activity / application restart.
1818
* If done so, it's behaviour can prevent duplicated fragment instances,
1919
* as React will render new ones on activity restart.
2020
*/
21-
class AutoRemovingFragment: Fragment() {
22-
21+
class AutoRemovingFragment : Fragment() {
2322
override fun onCreate(savedInstanceState: Bundle?) {
2423
super.onCreate(savedInstanceState)
2524

26-
// This is the first moment where we have access to non-null parent fragment manager,
27-
// so that we can remove the fragment from the hierarchy.
28-
parentFragmentManager.beginTransaction()
25+
// This is the first moment where we have access to non-null parent fragment manager,
26+
// so that we can remove the fragment from the hierarchy.
27+
parentFragmentManager
28+
.beginTransaction()
2929
.remove(this)
3030
.commitAllowingStateLoss()
3131
}
3232

3333
override fun onCreateView(
3434
inflater: LayoutInflater,
3535
container: ViewGroup?,
36-
savedInstanceState: Bundle?
36+
savedInstanceState: Bundle?,
3737
): View? = null
3838
}

android/src/main/java/com/swmansion/rnscreens/RNScreensFragmentFactory.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import androidx.fragment.app.Fragment
44
import androidx.fragment.app.FragmentFactory
55

66
class RNScreensFragmentFactory : FragmentFactory() {
7-
override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
8-
return if (className.startsWith(BuildConfig.LIBRARY_PACKAGE_NAME)) {
9-
AutoRemovingFragment();
7+
override fun instantiate(
8+
classLoader: ClassLoader,
9+
className: String,
10+
): Fragment =
11+
if (className.startsWith(BuildConfig.LIBRARY_PACKAGE_NAME)) {
12+
AutoRemovingFragment()
1013
} else {
1114
super.instantiate(classLoader, className)
1215
}
13-
}
1416
}

0 commit comments

Comments
 (0)