react-native-navigation 7.23.1 → 7.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/.buildkite/pipeline.yml +51 -11
  2. package/.nvmrc +1 -0
  3. package/Mock.d.ts +1 -0
  4. package/Mock.js +4 -0
  5. package/Mock.ts +1 -1
  6. package/README.md +0 -1
  7. package/jest.config.js +40 -0
  8. package/lib/{src/Mock → Mock}/Application.tsx +0 -0
  9. package/lib/{src/Mock → Mock}/ComponentProps.tsx +0 -0
  10. package/lib/{src/Mock → Mock}/Components/BottomTabs.tsx +0 -0
  11. package/lib/{src/Mock → Mock}/Components/ComponentScreen.tsx +13 -2
  12. package/lib/{src/Mock → Mock}/Components/LayoutComponent.tsx +0 -0
  13. package/lib/{src/Mock → Mock}/Components/Modals.tsx +0 -0
  14. package/lib/{src/Mock → Mock}/Components/NavigationButton.tsx +1 -1
  15. package/lib/{src/Mock → Mock}/Components/Overlays.tsx +0 -0
  16. package/lib/{src/Mock → Mock}/Components/Stack.tsx +0 -0
  17. package/lib/{src/Mock → Mock}/Components/TopBar.tsx +2 -2
  18. package/lib/{src/Mock → Mock}/Layouts/BottomTabsNode.ts +1 -1
  19. package/lib/{src/Mock → Mock}/Layouts/ComponentNode.ts +1 -1
  20. package/lib/{src/Mock → Mock}/Layouts/LayoutNodeFactory.ts +0 -0
  21. package/lib/{src/Mock → Mock}/Layouts/Node.ts +1 -1
  22. package/lib/{src/Mock → Mock}/Layouts/ParentNode.ts +2 -2
  23. package/lib/{src/Mock → Mock}/Layouts/StackNode.ts +0 -0
  24. package/lib/{src/Mock → Mock}/Stores/EventsStore.ts +10 -2
  25. package/lib/{src/Mock → Mock}/Stores/LayoutStore.ts +3 -2
  26. package/lib/{src/Mock → Mock}/connect.ts +0 -0
  27. package/lib/Mock/constants.d.ts +2 -0
  28. package/lib/Mock/constants.js +5 -0
  29. package/lib/{src/Mock → Mock}/constants.ts +0 -0
  30. package/lib/Mock/index.d.ts +3 -0
  31. package/lib/Mock/index.js +14 -0
  32. package/lib/{src/Mock → Mock}/index.ts +0 -0
  33. package/lib/{src/Mock → Mock}/mocks/AppRegistryService.ts +0 -0
  34. package/lib/{src/Mock → Mock}/mocks/NativeCommandsSender.tsx +1 -1
  35. package/lib/{src/Mock → Mock}/mocks/NativeEventsReceiver.ts +7 -4
  36. package/lib/android/app/build.gradle +23 -21
  37. package/lib/android/app/src/main/java/com/reactnativenavigation/options/FontOptions.kt +2 -2
  38. package/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt +35 -2
  39. package/lib/android/app/src/main/java/com/reactnativenavigation/options/LayoutFactory.java +32 -17
  40. package/lib/android/app/src/main/java/com/reactnativenavigation/options/Options.java +1 -1
  41. package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/TypefaceLoader.kt +16 -10
  42. package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +5 -2
  43. package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalFrameLayout.kt +3 -3
  44. package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt +11 -8
  45. package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +168 -0
  46. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +5 -2
  47. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +42 -2
  48. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +12 -16
  49. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +19 -11
  50. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/externalcomponent/ExternalComponentViewController.java +2 -2
  51. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +6 -4
  52. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManager.kt +8 -3
  53. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +15 -7
  54. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +127 -138
  55. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +183 -22
  56. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +25 -4
  57. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +9 -1
  58. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonSpan.kt +1 -1
  59. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +52 -71
  60. package/lib/android/app/src/main/java/com/reactnativenavigation/views/component/ComponentLayout.java +2 -0
  61. package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageMatrixAnimator.kt +2 -3
  62. package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java +1 -2
  63. package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/ButtonBar.kt +7 -12
  64. package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleAndButtonsContainer.kt +0 -2
  65. package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleSubTitleLayout.kt +0 -7
  66. package/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +2 -1
  67. package/lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java +7 -6
  68. package/lib/android/app/src/test/java/com/reactnativenavigation/TestActivity.java +5 -0
  69. package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/ImageLoaderMock.kt +5 -4
  70. package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/Mocks.kt +3 -2
  71. package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TypefaceLoaderMock.kt +5 -1
  72. package/lib/android/app/src/test/java/com/reactnativenavigation/options/TransitionAnimationOptionsTest.kt +2 -3
  73. package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/PresenterTest.java +25 -10
  74. package/lib/android/app/src/test/java/com/reactnativenavigation/utils/LayoutFactoryTest.java +25 -2
  75. package/lib/android/app/src/test/java/com/reactnativenavigation/utils/MotionEventTest.kt +1 -1
  76. package/lib/android/app/src/test/java/com/reactnativenavigation/utils/{TitleAndButtonsMeasurer.kt → TitleAndButtonsMeasurerTest.kt} +2 -2
  77. package/lib/android/app/src/test/java/com/reactnativenavigation/utils/UiThreadTest.java +2 -2
  78. package/lib/android/app/src/test/java/com/reactnativenavigation/utils/UiUtilsTest.java +1 -1
  79. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.kt +572 -0
  80. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsPresenterTest.kt +1 -1
  81. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllerTest.java +2 -1
  82. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewControllerTest.java +5 -5
  83. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/fakes/FakeParentController.kt +1 -1
  84. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalAnimatorTest.kt +1 -1
  85. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +7 -3
  86. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +17 -4
  87. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +2 -2
  88. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.kt +5 -5
  89. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManagerTest.java +1 -0
  90. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/parent/ParentControllerTest.java +4 -0
  91. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java +6 -2
  92. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimatorTest.kt +1 -1
  93. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +13 -8
  94. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenterTest.kt +58 -51
  95. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarControllerTest.kt +219 -41
  96. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewControllerTest.java +4 -1
  97. package/lib/android/app/src/test/java/com/reactnativenavigation/views/TitleAndButtonsContainerTest.kt +2 -2
  98. package/lib/android/app/src/test/java/com/reactnativenavigation/views/animations/BaseViewAnimatorTest.kt +4 -4
  99. package/lib/android/app/src/test/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainerTest.kt +1 -1
  100. package/lib/android/app/src/test/java/com/reactnativenavigation/views/bottomtabs/BottomTabsTest.kt +4 -4
  101. package/lib/dist/Mock/Application.js +2 -2
  102. package/lib/dist/Mock/Components/BottomTabs.js +2 -2
  103. package/lib/dist/Mock/Components/ComponentScreen.js +15 -5
  104. package/lib/dist/Mock/Components/LayoutComponent.js +3 -2
  105. package/lib/dist/Mock/Components/Modals.js +2 -2
  106. package/lib/dist/Mock/Components/NavigationButton.d.ts +1 -1
  107. package/lib/dist/Mock/Components/NavigationButton.js +8 -10
  108. package/lib/dist/Mock/Components/Overlays.js +2 -2
  109. package/lib/dist/Mock/Components/Stack.js +2 -2
  110. package/lib/dist/Mock/Components/TopBar.d.ts +2 -2
  111. package/lib/dist/Mock/Components/TopBar.js +7 -6
  112. package/lib/dist/Mock/Layouts/BottomTabsNode.d.ts +1 -1
  113. package/lib/dist/Mock/Layouts/BottomTabsNode.js +3 -3
  114. package/lib/dist/Mock/Layouts/ComponentNode.d.ts +1 -1
  115. package/lib/dist/Mock/Layouts/ComponentNode.js +4 -4
  116. package/lib/dist/Mock/Layouts/LayoutNodeFactory.js +3 -3
  117. package/lib/dist/Mock/Layouts/Node.d.ts +1 -1
  118. package/lib/dist/Mock/Layouts/Node.js +5 -0
  119. package/lib/dist/Mock/Layouts/ParentNode.d.ts +2 -2
  120. package/lib/dist/Mock/Layouts/ParentNode.js +4 -3
  121. package/lib/dist/Mock/Layouts/StackNode.js +1 -1
  122. package/lib/dist/Mock/Stores/EventsStore.d.ts +5 -2
  123. package/lib/dist/Mock/Stores/EventsStore.js +7 -0
  124. package/lib/dist/Mock/Stores/LayoutStore.js +6 -3
  125. package/lib/dist/Mock/connect.js +1 -1
  126. package/lib/dist/Mock/index.js +1 -1
  127. package/lib/dist/Mock/mocks/NativeCommandsSender.d.ts +1 -1
  128. package/lib/dist/Mock/mocks/NativeCommandsSender.js +2 -2
  129. package/lib/dist/Mock/mocks/NativeEventsReceiver.d.ts +3 -3
  130. package/lib/dist/Mock/mocks/NativeEventsReceiver.js +6 -3
  131. package/lib/dist/{Navigation.d.ts → src/Navigation.d.ts} +0 -0
  132. package/lib/dist/{Navigation.js → src/Navigation.js} +19 -3
  133. package/lib/dist/{NavigationDelegate.d.ts → src/NavigationDelegate.d.ts} +0 -0
  134. package/lib/dist/{NavigationDelegate.js → src/NavigationDelegate.js} +1 -0
  135. package/lib/dist/{adapters → src/adapters}/AppRegistryService.d.ts +0 -0
  136. package/lib/dist/{adapters → src/adapters}/AppRegistryService.js +0 -0
  137. package/lib/dist/{adapters → src/adapters}/AssetResolver.d.ts +0 -0
  138. package/lib/dist/{adapters → src/adapters}/AssetResolver.js +0 -0
  139. package/lib/dist/src/adapters/ColorService.d.ts +3 -0
  140. package/lib/dist/{adapters → src/adapters}/ColorService.js +1 -1
  141. package/lib/dist/{adapters → src/adapters}/Constants.d.ts +0 -0
  142. package/lib/dist/{adapters → src/adapters}/Constants.js +10 -6
  143. package/lib/dist/{adapters → src/adapters}/NativeCommandsSender.d.ts +0 -0
  144. package/lib/dist/{adapters → src/adapters}/NativeCommandsSender.js +1 -0
  145. package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.d.ts +0 -0
  146. package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.js +1 -0
  147. package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.mock.d.ts +0 -0
  148. package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.mock.js +0 -0
  149. package/lib/dist/{adapters → src/adapters}/TouchablePreview.d.ts +0 -0
  150. package/lib/dist/src/adapters/TouchablePreview.js +89 -0
  151. package/lib/dist/{adapters → src/adapters}/UniqueIdProvider.d.ts +0 -0
  152. package/lib/dist/{adapters → src/adapters}/UniqueIdProvider.js +2 -2
  153. package/lib/dist/{commands → src/commands}/Commands.d.ts +0 -0
  154. package/lib/dist/{commands → src/commands}/Commands.js +24 -10
  155. package/lib/dist/{commands → src/commands}/Deprecations.d.ts +0 -0
  156. package/lib/dist/src/commands/Deprecations.js +80 -0
  157. package/lib/dist/{commands → src/commands}/LayoutTreeCrawler.d.ts +0 -0
  158. package/lib/dist/{commands → src/commands}/LayoutTreeCrawler.js +4 -2
  159. package/lib/dist/{commands → src/commands}/LayoutTreeParser.d.ts +0 -0
  160. package/lib/dist/{commands → src/commands}/LayoutTreeParser.js +1 -0
  161. package/lib/dist/{commands → src/commands}/LayoutType.d.ts +0 -0
  162. package/lib/dist/{commands → src/commands}/LayoutType.js +0 -0
  163. package/lib/dist/{commands → src/commands}/OptionsCrawler.d.ts +0 -0
  164. package/lib/dist/{commands → src/commands}/OptionsCrawler.js +6 -4
  165. package/lib/dist/{commands → src/commands}/OptionsProcessor.d.ts +1 -1
  166. package/lib/dist/{commands → src/commands}/OptionsProcessor.js +50 -42
  167. package/lib/dist/{components → src/components}/ComponentRegistry.d.ts +0 -0
  168. package/lib/dist/{components → src/components}/ComponentRegistry.js +4 -0
  169. package/lib/dist/{components → src/components}/ComponentWrapper.d.ts +0 -0
  170. package/lib/dist/{components → src/components}/ComponentWrapper.js +17 -17
  171. package/lib/dist/{components → src/components}/Modal.d.ts +0 -0
  172. package/lib/dist/{components → src/components}/Modal.js +8 -8
  173. package/lib/dist/{components → src/components}/Store.d.ts +2 -0
  174. package/lib/dist/{components → src/components}/Store.js +13 -6
  175. package/lib/dist/{events → src/events}/CommandsObserver.d.ts +0 -0
  176. package/lib/dist/{events → src/events}/CommandsObserver.js +2 -1
  177. package/lib/dist/{events → src/events}/ComponentEventsObserver.d.ts +4 -2
  178. package/lib/dist/{events → src/events}/ComponentEventsObserver.js +16 -14
  179. package/lib/dist/{events → src/events}/EventsRegistry.d.ts +2 -2
  180. package/lib/dist/{events → src/events}/EventsRegistry.js +3 -0
  181. package/lib/dist/{index.d.ts → src/index.d.ts} +0 -0
  182. package/lib/dist/src/index.js +22 -0
  183. package/lib/dist/{interfaces → src/interfaces}/CommandName.d.ts +0 -0
  184. package/lib/dist/{interfaces → src/interfaces}/CommandName.js +0 -0
  185. package/lib/dist/{interfaces → src/interfaces}/ComponentEvents.d.ts +0 -0
  186. package/lib/dist/{interfaces → src/interfaces}/ComponentEvents.js +0 -0
  187. package/lib/dist/{interfaces → src/interfaces}/EventSubscription.d.ts +0 -0
  188. package/lib/dist/{interfaces → src/interfaces}/EventSubscription.js +0 -0
  189. package/lib/dist/{interfaces → src/interfaces}/Events.d.ts +0 -0
  190. package/lib/dist/{interfaces → src/interfaces}/Events.js +0 -0
  191. package/lib/dist/{interfaces → src/interfaces}/Layout.d.ts +0 -0
  192. package/lib/dist/{interfaces → src/interfaces}/Layout.js +0 -0
  193. package/lib/dist/{interfaces → src/interfaces}/NavigationComponent.d.ts +0 -0
  194. package/lib/dist/{interfaces → src/interfaces}/NavigationComponent.js +8 -1
  195. package/lib/dist/{interfaces → src/interfaces}/NavigationComponentListener.d.ts +0 -0
  196. package/lib/dist/{interfaces → src/interfaces}/NavigationComponentListener.js +0 -0
  197. package/lib/dist/{interfaces → src/interfaces}/NavigationComponentProps.d.ts +0 -0
  198. package/lib/dist/{interfaces → src/interfaces}/NavigationComponentProps.js +0 -0
  199. package/lib/dist/{interfaces → src/interfaces}/NavigationFunctionComponent.d.ts +0 -0
  200. package/lib/dist/{interfaces → src/interfaces}/NavigationFunctionComponent.js +0 -0
  201. package/lib/dist/{interfaces → src/interfaces}/Options.d.ts +9 -0
  202. package/lib/dist/{interfaces → src/interfaces}/Options.js +0 -0
  203. package/lib/dist/{interfaces → src/interfaces}/ProcessorSubscription.d.ts +0 -0
  204. package/lib/dist/{interfaces → src/interfaces}/ProcessorSubscription.js +0 -0
  205. package/lib/dist/{interfaces → src/interfaces}/Processors.d.ts +0 -0
  206. package/lib/dist/{interfaces → src/interfaces}/Processors.js +0 -0
  207. package/lib/dist/{processors → src/processors}/LayoutProcessor.d.ts +0 -0
  208. package/lib/dist/{processors → src/processors}/LayoutProcessor.js +1 -0
  209. package/lib/dist/{processors → src/processors}/LayoutProcessorsStore.d.ts +0 -0
  210. package/lib/dist/{processors → src/processors}/LayoutProcessorsStore.js +1 -3
  211. package/lib/dist/{processors → src/processors}/OptionProcessorsStore.d.ts +0 -0
  212. package/lib/dist/{processors → src/processors}/OptionProcessorsStore.js +1 -3
  213. package/lib/dist/{types.d.ts → src/types.d.ts} +0 -0
  214. package/lib/dist/{types.js → src/types.js} +0 -0
  215. package/lib/ios/AnimationObserver.h +17 -0
  216. package/lib/ios/AnimationObserver.m +41 -0
  217. package/lib/ios/BottomTabPresenter.h +0 -3
  218. package/lib/ios/BottomTabPresenter.m +0 -8
  219. package/lib/ios/RNNAssert.h +2 -2
  220. package/lib/ios/RNNBasePresenter.h +0 -4
  221. package/lib/ios/RNNBasePresenter.m +0 -12
  222. package/lib/ios/RNNBottomTabOptions.m +2 -1
  223. package/lib/ios/RNNBottomTabsController.m +8 -8
  224. package/lib/ios/RNNBridgeManager.mm +0 -1
  225. package/lib/ios/RNNButtonBuilder.m +2 -0
  226. package/lib/ios/RNNButtonOptions.h +1 -0
  227. package/lib/ios/RNNButtonOptions.m +4 -0
  228. package/lib/ios/RNNCommandsHandler.m +15 -8
  229. package/lib/ios/RNNComponentPresenter.m +0 -4
  230. package/lib/ios/RNNComponentViewController.m +2 -4
  231. package/lib/ios/RNNDotIndicatorPresenter.m +2 -1
  232. package/lib/ios/RNNExternalViewController.m +2 -4
  233. package/lib/ios/RNNModalManager.h +2 -1
  234. package/lib/ios/RNNModalManager.m +12 -21
  235. package/lib/ios/RNNSegmentedControl.h +1 -1
  236. package/lib/ios/RNNSideMenuChildVC.m +0 -4
  237. package/lib/ios/RNNSideMenuController.m +0 -4
  238. package/lib/ios/RNNSplitViewController.m +0 -4
  239. package/lib/ios/RNNStackController.m +0 -4
  240. package/lib/ios/RNNStackPresenter.m +3 -0
  241. package/lib/ios/RNNSwizzles.m +20 -0
  242. package/lib/ios/RNNTabBarItemCreator.m +3 -2
  243. package/lib/ios/RNNUIBarButtonItem.h +2 -0
  244. package/lib/ios/RNNUIBarButtonItem.m +17 -0
  245. package/lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +8 -0
  246. package/lib/ios/TopBarPresenter.m +8 -4
  247. package/lib/ios/UIViewController+RNNOptions.m +1 -1
  248. package/lib/src/commands/Commands.ts +6 -1
  249. package/lib/src/commands/LayoutTreeCrawler.ts +2 -2
  250. package/lib/src/commands/OptionsCrawler.ts +2 -1
  251. package/lib/src/commands/OptionsProcessor.ts +15 -13
  252. package/lib/src/components/Store.ts +9 -0
  253. package/lib/src/events/ComponentEventsObserver.ts +5 -1
  254. package/lib/src/events/EventsRegistry.ts +2 -1
  255. package/lib/src/interfaces/Options.ts +10 -0
  256. package/package.json +19 -60
  257. package/tsconfig.mocks.json +7 -0
  258. package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StatusBarUtils.java +0 -41
  259. package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java +0 -511
  260. package/lib/dist/adapters/ColorService.d.ts +0 -3
  261. package/lib/dist/adapters/TouchablePreview.js +0 -91
  262. package/lib/dist/commands/Deprecations.js +0 -82
  263. package/lib/dist/index.js +0 -22
@@ -4,26 +4,28 @@ import android.animation.AnimatorSet
4
4
  import android.app.Activity
5
5
  import android.content.Context
6
6
  import android.view.View
7
- import com.nhaarman.mockitokotlin2.*
7
+ import org.mockito.kotlin.*
8
8
  import com.reactnativenavigation.BaseTest
9
+ import com.reactnativenavigation.fakes.IconResolverFake
10
+ import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock
9
11
  import com.reactnativenavigation.options.BackButton
10
12
  import com.reactnativenavigation.options.ButtonOptions
13
+ import com.reactnativenavigation.options.ComponentOptions
11
14
  import com.reactnativenavigation.options.Options
12
15
  import com.reactnativenavigation.options.params.Bool
13
16
  import com.reactnativenavigation.options.params.Text
14
17
  import com.reactnativenavigation.react.Constants
15
18
  import com.reactnativenavigation.react.ReactView
16
- import com.reactnativenavigation.utils.CollectionUtils
17
19
  import com.reactnativenavigation.utils.TitleBarHelper
18
20
  import com.reactnativenavigation.utils.resetViewProperties
19
21
  import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarAnimator
20
22
  import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarController
21
23
  import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController
24
+ import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter
22
25
  import com.reactnativenavigation.views.stack.StackLayout
23
26
  import com.reactnativenavigation.views.stack.topbar.TopBar
24
27
  import org.assertj.core.api.Java6Assertions.assertThat
25
28
  import org.junit.Test
26
- import java.util.*
27
29
 
28
30
  class TopBarControllerTest : BaseTest() {
29
31
  private lateinit var uut: TopBarController
@@ -34,10 +36,16 @@ class TopBarControllerTest : BaseTest() {
34
36
  private lateinit var textButton2: ButtonOptions
35
37
  private lateinit var componentButton: ButtonOptions
36
38
  private lateinit var animator: TopBarAnimator
39
+ private lateinit var leftButtonControllers: MutableMap<String,ButtonController>
40
+ private lateinit var rightButtonControllers: MutableMap<String,ButtonController>
41
+
42
+
37
43
  private val topBar: View
38
44
  get() = uut.view
39
45
 
40
46
  override fun beforeEach() {
47
+ leftButtonControllers= mutableMapOf()
48
+ rightButtonControllers= mutableMapOf()
41
49
  activity = newActivity()
42
50
  animator = spy(TopBarAnimator())
43
51
  uut = createTopBarController()
@@ -48,68 +56,111 @@ class TopBarControllerTest : BaseTest() {
48
56
 
49
57
  @Test
50
58
  fun setButton_setsTextButton() {
51
- uut.applyRightButtons(rightButtons(textButton1)!!)
52
- uut.applyLeftButtons(leftButton(leftButton))
59
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(textButton1)){
60
+ createButtonController(it)
61
+ }
62
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
63
+ createButtonController(it)
64
+ }
53
65
  assertThat(uut.getRightButton(0).title.toString()).isEqualTo(textButton1.text.get())
54
66
  }
55
67
 
56
68
  @Test
57
69
  fun setButton_setsCustomButton() {
58
- uut.applyLeftButtons(leftButton(leftButton))
59
- uut.applyRightButtons(rightButtons(componentButton)!!)
70
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
71
+ createButtonController(it)
72
+ }
73
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(componentButton)){
74
+ createButtonController(it)
75
+ }
60
76
  val btnView = uut.getRightButton(0).actionView as ReactView
61
77
  assertThat(btnView.componentName).isEqualTo(componentButton.component.name.get())
62
78
  }
63
79
 
64
80
  @Test
65
81
  fun applyRightButtons_emptyButtonsListClearsRightButtons() {
66
- uut.applyLeftButtons(leftButton(leftButton))
67
- uut.applyRightButtons(rightButtons(componentButton, textButton1)!!)
68
- uut.applyLeftButtons(leftButton(leftButton))
69
- uut.applyRightButtons(ArrayList())
82
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
83
+ createButtonController(it)
84
+ }
85
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(componentButton, textButton1)){
86
+ createButtonController(it)
87
+ }
88
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
89
+ createButtonController(it)
90
+ }
91
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf()){
92
+ createButtonController(it)
93
+ }
70
94
  assertThat(uut.rightButtonCount).isEqualTo(0)
71
95
  }
72
96
 
73
97
  @Test
74
98
  fun applyRightButtons_previousButtonsAreCleared() {
75
- uut.applyRightButtons(rightButtons(textButton1, componentButton)!!)
99
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(textButton1, componentButton)){
100
+ createButtonController(it)
101
+ }
76
102
  assertThat(uut.rightButtonCount).isEqualTo(2)
77
- uut.applyRightButtons(rightButtons(textButton2)!!)
103
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(textButton2)){
104
+ createButtonController(it)
105
+ }
78
106
  assertThat(uut.rightButtonCount).isEqualTo(1)
79
107
  }
80
108
 
81
109
  @Test
82
110
  fun applyRightButtons_buttonsAreAddedInReversedOrderToMatchOrderOnIOs() {
83
- uut.applyLeftButtons(leftButton(leftButton))
84
- uut.applyRightButtons(rightButtons(textButton1, componentButton)!!)
111
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
112
+ createButtonController(it)
113
+ }
114
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf(textButton1, componentButton)){
115
+ createButtonController(it)
116
+ }
85
117
  assertThat(uut.getRightButton(1).title.toString()).isEqualTo(textButton1.text.get())
86
118
  }
87
119
 
88
120
  @Test
89
121
  fun applyRightButtons_componentButtonIsReapplied() {
90
- val initialButtons = rightButtons(componentButton)
91
- uut.applyRightButtons(initialButtons!!)
122
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf( componentButton)){
123
+ createButtonController(it)
124
+ }
92
125
  assertThat(uut.getRightButton(0).itemId).isEqualTo(componentButton.intId)
93
- uut.applyRightButtons(rightButtons(textButton1)!!)
126
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf( textButton1)){
127
+ createButtonController(it)
128
+ }
94
129
  assertThat(uut.getRightButton(0).itemId).isEqualTo(textButton1.intId)
95
- uut.applyRightButtons(initialButtons)
130
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf( componentButton)){
131
+ createButtonController(it)
132
+ }
96
133
  assertThat(uut.getRightButton(0).itemId).isEqualTo(componentButton.intId)
97
134
  }
98
135
 
99
136
  @Test
100
- fun mergeRightButtons_componentButtonIsNotAddedIfAlreadyAddedToMenu() {
101
- val initialButtons = rightButtons(componentButton)
102
- uut.applyRightButtons(initialButtons!!)
103
- uut.mergeRightButtons(initialButtons, emptyList())
137
+ fun mergeRightButtonsOptions_componentButtonIsNotAddedIfAlreadyAddedToMenu() {
138
+ val controllers = mutableMapOf<String,ButtonController>()
139
+ uut.applyRightButtonsOptions(controllers, listOf(componentButton)){
140
+ createButtonController(it)
141
+ }
142
+ verify(controllers[componentButton.id]!!, times(1)).addToMenu(any(), any())
143
+ uut.mergeRightButtonsOptions(controllers, listOf(componentButton.copy())){
144
+ createButtonController(it)
145
+ }
146
+ verify(controllers[componentButton.id]!!, times(1)).addToMenu(any(), any())
104
147
  }
105
148
 
106
149
  @Test
107
150
  fun setLeftButtons_emptyButtonsListClearsLeftButton() {
108
- uut.applyLeftButtons(leftButton(leftButton))
109
- uut.applyRightButtons(rightButtons(componentButton)!!)
151
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
152
+ createButtonController(it)
153
+ }
154
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf( componentButton)){
155
+ createButtonController(it)
156
+ }
110
157
  assertThat(uut.leftButtonCount).isNotZero()
111
- uut.applyLeftButtons(emptyList())
112
- uut.applyRightButtons(rightButtons(textButton1)!!)
158
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf()){
159
+ createButtonController(it)
160
+ }
161
+ uut.applyRightButtonsOptions(rightButtonControllers, listOf( textButton1)){
162
+ createButtonController(it)
163
+ }
113
164
  assertThat(uut.leftButtonCount).isZero()
114
165
  }
115
166
 
@@ -117,7 +168,9 @@ class TopBarControllerTest : BaseTest() {
117
168
  fun setLeftButtons_clearsBackButton() {
118
169
  uut.view.setBackButton(TitleBarHelper.createButtonController(activity, backButton))
119
170
  assertThat(uut.view.navigationIcon).isNotNull()
120
- uut.applyLeftButtons(leftButton(leftButton))
171
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf(leftButton)){
172
+ createButtonController(it)
173
+ }
121
174
  assertThat(uut.view.navigationIcon).isNull()
122
175
  }
123
176
 
@@ -125,25 +178,35 @@ class TopBarControllerTest : BaseTest() {
125
178
  fun setLeftButtons_emptyButtonsListClearsBackButton() {
126
179
  uut.view.setBackButton(TitleBarHelper.createButtonController(activity, backButton))
127
180
  assertThat(uut.view.navigationIcon).isNotNull()
128
- uut.applyLeftButtons(emptyList())
181
+ uut.applyLeftButtonsOptions(leftButtonControllers, listOf()){
182
+ createButtonController(it)
183
+ }
129
184
  assertThat(uut.view.navigationIcon).isNull()
130
185
  }
131
186
 
132
187
  @Test
133
188
  fun mergeLeftButtons_clearsBackButton() {
189
+ val controllers = mutableMapOf<String,ButtonController>()
134
190
  uut.view.setBackButton(TitleBarHelper.createButtonController(activity, backButton))
135
191
  assertThat(uut.view.navigationIcon).isNotNull()
136
- uut.mergeLeftButtons(emptyList(), leftButton(leftButton))
192
+ uut.mergeLeftButtonsOptions(controllers, listOf(leftButton)){
193
+ createButtonController(it)
194
+ }
137
195
  assertThat(uut.view.navigationIcon).isNull()
138
196
  }
139
197
 
140
198
  @Test
141
199
  fun mergeLeftButtons_emptyButtonsListClearsBackButton() {
200
+ val controllers = mutableMapOf<String,ButtonController>()
201
+
142
202
  uut.view.setBackButton(TitleBarHelper.createButtonController(activity, backButton))
143
203
  assertThat(uut.view.navigationIcon).isNotNull()
144
- val initialButtons = leftButton(leftButton)
145
- uut.applyLeftButtons(initialButtons)
146
- uut.mergeLeftButtons(initialButtons, emptyList())
204
+ uut.applyLeftButtonsOptions(controllers, listOf(leftButton)){
205
+ createButtonController(it)
206
+ }
207
+ uut.mergeLeftButtonsOptions(controllers, emptyList()){
208
+ createButtonController(it)
209
+ }
147
210
  assertThat(uut.view.navigationIcon).isNull()
148
211
  }
149
212
 
@@ -219,6 +282,128 @@ class TopBarControllerTest : BaseTest() {
219
282
  assertThat(result).isEqualTo(someAnimator)
220
283
  }
221
284
 
285
+ @Test
286
+ fun `mergeRightButtons - should add buttons`(){
287
+ val controllers = spy(LinkedHashMap<String,ButtonController>())
288
+ val controller = spy(ButtonController(activity, ButtonPresenter(activity, textButton1, IconResolverFake(activity)),
289
+ textButton1, TitleBarButtonCreatorMock(), object : ButtonController.OnClickListener {
290
+ override fun onPress(button: ButtonOptions) {
291
+
292
+ }
293
+
294
+ }))
295
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1)) {
296
+ controller
297
+ }
298
+ assertThat(uut.rightButtonCount).isEqualTo(1)
299
+ verify(controllers, never()).remove(any())
300
+ assertThat(controllers[textButton1.id]).isEqualTo(controller)
301
+ }
302
+ @Test
303
+ fun `mergeRightOptions - should destroy all buttons that was removed`(){
304
+ val componentButton2 = componentButton.copy()
305
+ componentButton2.component = ComponentOptions().apply {
306
+ this.name = componentButton.component.name
307
+ this.componentId = Text("CustomNewComponent")
308
+ }
309
+ uut.mergeRightButtonsOptions(rightButtonControllers, listOf(textButton1, textButton2, componentButton)) {
310
+ createButtonController(it)
311
+ }
312
+ val removedControllers = mutableMapOf<String, ButtonController>().apply {
313
+ putAll(rightButtonControllers)
314
+ }
315
+ uut.mergeRightButtonsOptions(rightButtonControllers, listOf(componentButton2)) {
316
+ createButtonController(it)
317
+ }
318
+ verify(removedControllers[textButton1.id]!!, times(1)).destroy()
319
+ verify(removedControllers[textButton2.id]!!, times(1)).destroy()
320
+ verify(removedControllers[componentButton.id]!!, times(1)).destroy()
321
+ }
322
+ @Test
323
+ fun `mergeRightButtons - should remove all and re-add buttons in case of reorder, without destroy`(){
324
+ uut.mergeRightButtonsOptions(rightButtonControllers, listOf(textButton1, textButton2)) {
325
+ createButtonController(it)
326
+ }
327
+ assertThat(uut.getRightButton(1).itemId ).isEqualTo(textButton1.intId)
328
+ assertThat(uut.getRightButton(0).itemId ).isEqualTo(textButton2.intId)
329
+ val removedControllers = mutableMapOf<String, ButtonController>().apply { putAll(rightButtonControllers) }
330
+ uut.mergeRightButtonsOptions(rightButtonControllers, listOf(textButton2.copy(), textButton1.copy())) {
331
+ createButtonController(it)
332
+ }
333
+ assertThat(uut.getRightButton(1).itemId ).isEqualTo(textButton2.intId)
334
+ assertThat(uut.getRightButton(0).itemId ).isEqualTo(textButton1.intId)
335
+
336
+ verify(removedControllers[textButton1.id]!!, never()).destroy()
337
+ verify(removedControllers[textButton2.id]!!, never()).destroy()
338
+
339
+ verify(rightButtonControllers[textButton1.id]!!, times(2)).addToMenu(any(), any())
340
+ verify(rightButtonControllers[textButton2.id]!!, times(2)).addToMenu(any(), any())
341
+ }
342
+ @Test
343
+ fun `mergeRightButtons - should rebuild menu when adding menu items, existing should not be destroyed`(){
344
+ val controllers = spy(LinkedHashMap<String,ButtonController>())
345
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1)) {
346
+ createButtonController(it)
347
+ }
348
+ assertThat(uut.rightButtonCount).isEqualTo(1)
349
+
350
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1, textButton2)) {
351
+ createButtonController(it)
352
+ }
353
+ assertThat(uut.rightButtonCount).isEqualTo(2)
354
+ verify(controllers, never()).remove(any())
355
+ verify(controllers[textButton1.id]!!, times(2)).addToMenu(any(), any())
356
+ }
357
+ @Test
358
+ fun `mergeRightButtons - should modify changed buttons`(){
359
+ val controllers = spy(LinkedHashMap<String,ButtonController>())
360
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1.apply {
361
+ this.enabled = Bool(true)
362
+ })) {
363
+ createButtonController(it)
364
+ }
365
+ assertThat(uut.rightButtonCount).isEqualTo(1)
366
+ verify(controllers[textButton1.id]!!, times(1)).addToMenu(any(), any())
367
+
368
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1.copy().apply { this.enabled= Bool(false) })) {
369
+ createButtonController(it)
370
+ }
371
+ verify(controllers, never()).remove(any())
372
+ verify(controllers[textButton1.id]!!, times(1)).mergeButtonOptions(any(), any())
373
+ verify(controllers[textButton1.id]!!, times(1)).addToMenu(any(), any())
374
+ verify(controllers[textButton1.id]!!, never()).destroy()
375
+ }
376
+
377
+ @Test
378
+ fun `mergeRightButtons - reorder of same menu items should rebuild menu, not view recreation`(){
379
+ val controllers = spy(LinkedHashMap<String,ButtonController>())
380
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton1, textButton2)) {
381
+ createButtonController(it)
382
+ }
383
+ assertThat(uut.rightButtonCount).isEqualTo(2)
384
+ verify(controllers[textButton1.id]!!, times(1)).addToMenu(any(), any())
385
+ verify(controllers[textButton2.id]!!, times(1)).addToMenu(any(), any())
386
+
387
+ uut.mergeRightButtonsOptions(controllers, listOf(textButton2.copy(), textButton1.copy())) {
388
+ createButtonController(it)
389
+ }
390
+ verify(controllers[textButton1.id]!!, never()).mergeButtonOptions(any(), any())
391
+ verify(controllers[textButton2.id]!!, never()).mergeButtonOptions(any(), any())
392
+ verify(controllers[textButton1.id]!!, times(2)).addToMenu(any(), any())
393
+ verify(controllers[textButton2.id]!!, times(2)).addToMenu(any(), any())
394
+ verify(controllers[textButton1.id]!!, never()).destroy()
395
+ verify(controllers[textButton2.id]!!, never()).destroy()
396
+ }
397
+
398
+ private fun createButtonController(it: ButtonOptions) =
399
+ spy(ButtonController(activity, ButtonPresenter(activity, it, IconResolverFake(activity)),
400
+ it, TitleBarButtonCreatorMock(), object : ButtonController.OnClickListener {
401
+ override fun onPress(button: ButtonOptions) {
402
+
403
+ }
404
+
405
+ }))
406
+
222
407
  private fun createButtons() {
223
408
  leftButton = ButtonOptions()
224
409
  leftButton.id = Constants.BACK_BUTTON_ID
@@ -238,17 +423,10 @@ class TopBarControllerTest : BaseTest() {
238
423
  return button
239
424
  }
240
425
 
241
- private fun leftButton(leftButton: ButtonOptions): List<ButtonController> {
242
- return listOf(TitleBarHelper.createButtonController(activity, leftButton))
243
- }
244
-
245
- private fun rightButtons(vararg buttons: ButtonOptions): List<ButtonController>? {
246
- return CollectionUtils.map(listOf(*buttons)) { button: ButtonOptions? -> TitleBarHelper.createButtonController(activity, button) }
247
- }
248
-
249
426
  private fun createTopBarController() = spy(object : TopBarController(animator) {
250
427
  override fun createTopBar(context: Context, stackLayout: StackLayout): TopBar {
251
428
  return spy(super.createTopBar(context, stackLayout))
252
429
  }
253
430
  })
431
+
254
432
  }
@@ -31,6 +31,7 @@ import org.robolectric.Shadows;
31
31
  import java.lang.reflect.Field;
32
32
 
33
33
  import static org.assertj.core.api.Java6Assertions.assertThat;
34
+ import static org.mockito.ArgumentMatchers.any;
34
35
  import static org.mockito.Mockito.mock;
35
36
  import static org.mockito.Mockito.spy;
36
37
  import static org.mockito.Mockito.times;
@@ -51,7 +52,9 @@ public class ViewControllerTest extends BaseTest {
51
52
  activity = newActivity();
52
53
  childRegistry = new ChildControllersRegistry();
53
54
  uut = new SimpleViewController(activity, childRegistry, "uut", new Options());
54
- uut.setParentController(mock(ParentController.class));
55
+ final ParentController<?> parent = mock(ParentController.class);
56
+ uut.setParentController(parent);
57
+ Mockito.when(parent.resolveChildOptions(any())).thenReturn(Options.EMPTY);
55
58
  }
56
59
 
57
60
  @Test
@@ -7,8 +7,8 @@ import android.view.View
7
7
  import android.view.ViewGroup
8
8
  import android.widget.FrameLayout
9
9
  import android.widget.LinearLayout
10
- import com.nhaarman.mockitokotlin2.spy
11
- import com.nhaarman.mockitokotlin2.verify
10
+ import org.mockito.kotlin.spy
11
+ import org.mockito.kotlin.verify
12
12
  import com.reactnativenavigation.BaseTest
13
13
  import com.reactnativenavigation.options.Alignment
14
14
  import com.reactnativenavigation.options.params.Colour
@@ -2,14 +2,14 @@ package com.reactnativenavigation.views.animations
2
2
 
3
3
  import android.animation.Animator
4
4
  import android.view.View
5
- import com.nhaarman.mockitokotlin2.mock
6
- import com.nhaarman.mockitokotlin2.spy
7
- import com.nhaarman.mockitokotlin2.verify
8
- import com.nhaarman.mockitokotlin2.whenever
9
5
  import com.reactnativenavigation.BaseTest
10
6
  import com.reactnativenavigation.options.AnimationOptions
11
7
  import org.assertj.core.api.Java6Assertions.assertThat
12
8
  import org.junit.Test
9
+ import org.mockito.kotlin.mock
10
+ import org.mockito.kotlin.spy
11
+ import org.mockito.kotlin.verify
12
+ import org.mockito.kotlin.whenever
13
13
 
14
14
  class BaseViewAnimatorTest : BaseTest() {
15
15
  private lateinit var uut: BaseViewAnimator<View>
@@ -6,7 +6,7 @@ import android.graphics.drawable.ColorDrawable
6
6
  import android.view.View
7
7
  import android.widget.LinearLayout
8
8
  import androidx.core.graphics.ColorUtils
9
- import com.nhaarman.mockitokotlin2.*
9
+ import org.mockito.kotlin.*
10
10
  import com.reactnativenavigation.BaseTest
11
11
  import org.assertj.core.api.Assertions.assertThat
12
12
  import org.junit.Test
@@ -1,9 +1,9 @@
1
1
  package com.reactnativenavigation.views.bottomtabs
2
2
 
3
- import com.nhaarman.mockitokotlin2.never
4
- import com.nhaarman.mockitokotlin2.spy
5
- import com.nhaarman.mockitokotlin2.times
6
- import com.nhaarman.mockitokotlin2.verify
3
+ import org.mockito.kotlin.never
4
+ import org.mockito.kotlin.spy
5
+ import org.mockito.kotlin.times
6
+ import org.mockito.kotlin.verify
7
7
  import com.reactnativenavigation.BaseTest
8
8
  import org.junit.Test
9
9
 
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Application = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
5
+ const React = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
7
  const connect_1 = require("./connect");
8
- exports.Application = connect_1.connect(class extends React.Component {
8
+ exports.Application = (0, connect_1.connect)(class extends React.Component {
9
9
  constructor(props) {
10
10
  super(props);
11
11
  props.entryPoint();
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BottomTabs = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const LayoutComponent_1 = require("./LayoutComponent");
7
7
  const connect_1 = require("../connect");
8
- exports.BottomTabs = connect_1.connect(class extends react_1.Component {
8
+ exports.BottomTabs = (0, connect_1.connect)(class extends react_1.Component {
9
9
  render() {
10
10
  return this.props.layoutNode.children.map((child) => {
11
11
  return react_1.default.createElement(LayoutComponent_1.LayoutComponent, { key: child.nodeId, layoutNode: child });
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentScreen = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
- const __1 = require("../..");
7
+ const src_1 = require("../../src");
8
8
  const constants_1 = require("../constants");
9
9
  const LayoutStore_1 = require("../Stores/LayoutStore");
10
10
  const connect_1 = require("../connect");
11
11
  const TopBar_1 = require("./TopBar");
12
- exports.ComponentScreen = connect_1.connect(class extends react_1.Component {
12
+ const EventsStore_1 = require("../Stores/EventsStore");
13
+ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
14
+ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component {
13
15
  constructor(props) {
14
16
  super(props);
15
17
  }
@@ -29,13 +31,21 @@ exports.ComponentScreen = connect_1.connect(class extends react_1.Component {
29
31
  const buttons = bottomTabs.children.map((child, i) => {
30
32
  const bottomTabOptions = child.resolveOptions().bottomTab;
31
33
  return (react_1.default.createElement(react_native_1.View, { key: `tab-${i}` },
32
- react_1.default.createElement(react_native_1.Button, { testID: bottomTabOptions?.testID, title: bottomTabOptions?.text || '', onPress: () => LayoutStore_1.LayoutStore.selectTabIndex(this.props.layoutNode.getBottomTabs(), i) }),
34
+ react_1.default.createElement(react_native_1.Button, { testID: bottomTabOptions?.testID, title: bottomTabOptions?.text || '', onPress: () => {
35
+ EventsStore_1.events.invokeBottomTabPressed({
36
+ tabIndex: i,
37
+ });
38
+ if (lodash_1.default.defaultTo(bottomTabOptions?.selectTabOnPress, true))
39
+ LayoutStore_1.LayoutStore.selectTabIndex(this.props.layoutNode.getBottomTabs(), i);
40
+ } }),
33
41
  react_1.default.createElement(react_native_1.Text, null, bottomTabOptions?.badge)));
34
42
  });
35
43
  return react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID }, buttons);
36
44
  }
37
45
  render() {
38
- const Component = __1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
46
+ const Component = src_1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
47
+ if (!Component)
48
+ throw new Error(`${this.props.layoutNode.data.name} has not been registered.`);
39
49
  return (react_1.default.createElement(react_native_1.View, { testID: this.isVisible() ? constants_1.VISIBLE_SCREEN_TEST_ID : undefined },
40
50
  this.props.layoutNode.getStack() && (react_1.default.createElement(TopBar_1.TopBar, { layoutNode: this.props.layoutNode, topBarOptions: this.props.layoutNode.resolveOptions().topBar, backButtonOptions: this.props.layoutNode.resolveOptions().topBar?.backButton })),
41
51
  this.renderTabBar(),
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LayoutComponent = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
7
  const BottomTabs_1 = require("./BottomTabs");
8
8
  const ComponentScreen_1 = require("./ComponentScreen");
9
9
  const Stack_1 = require("./Stack");
10
- exports.LayoutComponent = class extends react_1.Component {
10
+ const LayoutComponent = class extends react_1.Component {
11
11
  render() {
12
12
  switch (this.props.layoutNode.type) {
13
13
  case 'BottomTabs':
@@ -20,3 +20,4 @@ exports.LayoutComponent = class extends react_1.Component {
20
20
  return react_1.default.createElement(react_native_1.View, null);
21
21
  }
22
22
  };
23
+ exports.LayoutComponent = LayoutComponent;
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Modals = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
7
  const LayoutComponent_1 = require("./LayoutComponent");
8
8
  const LayoutStore_1 = require("../Stores/LayoutStore");
9
9
  const connect_1 = require("../connect");
10
- exports.Modals = connect_1.connect(class extends react_1.Component {
10
+ exports.Modals = (0, connect_1.connect)(class extends react_1.Component {
11
11
  render() {
12
12
  const children = LayoutStore_1.LayoutStore.getModals();
13
13
  return (react_1.default.createElement(react_native_1.View, { testID: 'MODALS' }, children.map((child) => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { OptionsTopBarButton } from '../../';
2
+ import { OptionsTopBarButton } from '../../src';
3
3
  interface ButtonProps {
4
4
  button: OptionsTopBarButton;
5
5
  componentId: string;
@@ -2,15 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NavigationButton = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
- const __1 = require("../../");
7
+ const src_1 = require("../../src");
8
8
  const EventsStore_1 = require("../Stores/EventsStore");
9
- exports.NavigationButton = class extends react_1.Component {
10
- constructor() {
11
- super(...arguments);
12
- this.ref = undefined;
13
- }
9
+ const NavigationButton = class extends react_1.Component {
10
+ ref = undefined;
14
11
  render() {
15
12
  const { button, componentId } = this.props;
16
13
  if (button.component)
@@ -26,8 +23,8 @@ exports.NavigationButton = class extends react_1.Component {
26
23
  //@ts-ignore
27
24
  const buttonComponentId = button.component.componentId;
28
25
  //@ts-ignore
29
- const Component = __1.Navigation.mock.store.getComponentClassForName(button.component.name)();
30
- const props = __1.Navigation.mock.store.getPropsForId(buttonComponentId);
26
+ const Component = src_1.Navigation.mock.store.getComponentClassForName(button.component.name)();
27
+ const props = src_1.Navigation.mock.store.getPropsForId(buttonComponentId);
31
28
  return (react_1.default.createElement(react_native_1.TouchableOpacity, { onPress: () => {
32
29
  if (this.ref) {
33
30
  // @ts-ignore
@@ -38,7 +35,7 @@ exports.NavigationButton = class extends react_1.Component {
38
35
  componentId: componentId,
39
36
  });
40
37
  }, testID: button.testID },
41
- react_1.default.createElement(Component, Object.assign({ key: buttonComponentId }, props, { componentId: buttonComponentId, ref: (ref) => (this.ref = ref) }))));
38
+ react_1.default.createElement(Component, { key: buttonComponentId, ...props, componentId: buttonComponentId, ref: (ref) => (this.ref = ref) })));
42
39
  }
43
40
  invokeOnClick(stateNode) {
44
41
  if (stateNode.children) {
@@ -53,3 +50,4 @@ exports.NavigationButton = class extends react_1.Component {
53
50
  }
54
51
  }
55
52
  };
53
+ exports.NavigationButton = NavigationButton;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Overlays = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const react_native_1 = require("react-native");
7
7
  const constants_1 = require("../constants");
8
8
  const LayoutComponent_1 = require("./LayoutComponent");
9
9
  const LayoutStore_1 = require("../Stores/LayoutStore");
10
10
  const connect_1 = require("../connect");
11
- exports.Overlays = connect_1.connect(class extends react_1.Component {
11
+ exports.Overlays = (0, connect_1.connect)(class extends react_1.Component {
12
12
  render() {
13
13
  const children = LayoutStore_1.LayoutStore.getOverlays();
14
14
  return (react_1.default.createElement(react_native_1.View, { testID: constants_1.VISIBLE_OVERLAY_TEST_ID }, children.map((child) => {
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Stack = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const LayoutComponent_1 = require("./LayoutComponent");
7
7
  const connect_1 = require("../connect");
8
- exports.Stack = connect_1.connect(class extends react_1.Component {
8
+ exports.Stack = (0, connect_1.connect)(class extends react_1.Component {
9
9
  render() {
10
10
  const children = this.props.layoutNode.children;
11
11
  return children.map((child, i) => {