react-native-navigation 8.7.4 → 8.7.5
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.
- package/ios/RNNNavigationOptions.h +1 -0
- package/ios/RNNNavigationOptions.mm +4 -0
- package/ios/RNNOverlayManager.mm +4 -0
- package/ios/ScreenAnimationController.mm +29 -24
- package/ios/StackControllerDelegate.mm +21 -3
- package/lib/module/Mock/Application.js +33 -0
- package/lib/module/Mock/Application.js.map +1 -0
- package/lib/module/Mock/ComponentProps.js +4 -0
- package/lib/module/Mock/ComponentProps.js.map +1 -0
- package/lib/module/Mock/Components/BottomTabs.js +16 -0
- package/lib/module/Mock/Components/BottomTabs.js.map +1 -0
- package/lib/module/Mock/Components/ComponentScreen.js +101 -0
- package/lib/module/Mock/Components/ComponentScreen.js.map +1 -0
- package/lib/module/Mock/Components/LayoutComponent.js +50 -0
- package/lib/module/Mock/Components/LayoutComponent.js.map +1 -0
- package/lib/module/Mock/Components/Modals.js +22 -0
- package/lib/module/Mock/Components/Modals.js.map +1 -0
- package/lib/module/Mock/Components/NavigationButton.js +72 -0
- package/lib/module/Mock/Components/NavigationButton.js.map +1 -0
- package/lib/module/Mock/Components/Overlays.js +23 -0
- package/lib/module/Mock/Components/Overlays.js.map +1 -0
- package/lib/module/Mock/Components/SideMenu.js +29 -0
- package/lib/module/Mock/Components/SideMenu.js.map +1 -0
- package/lib/module/Mock/Components/Stack.js +18 -0
- package/lib/module/Mock/Components/Stack.js.map +1 -0
- package/lib/module/Mock/Components/TopBar.js +81 -0
- package/lib/module/Mock/Components/TopBar.js.map +1 -0
- package/lib/module/Mock/Layouts/BottomTabsNode.js +30 -0
- package/lib/module/Mock/Layouts/BottomTabsNode.js.map +1 -0
- package/lib/module/Mock/Layouts/ComponentNode.js +102 -0
- package/lib/module/Mock/Layouts/ComponentNode.js.map +1 -0
- package/lib/module/Mock/Layouts/LayoutNodeFactory.js +28 -0
- package/lib/module/Mock/Layouts/LayoutNodeFactory.js.map +1 -0
- package/lib/module/Mock/Layouts/Node.js +14 -0
- package/lib/module/Mock/Layouts/Node.js.map +1 -0
- package/lib/module/Mock/Layouts/ParentNode.js +66 -0
- package/lib/module/Mock/Layouts/ParentNode.js.map +1 -0
- package/lib/module/Mock/Layouts/SideMenu.js +72 -0
- package/lib/module/Mock/Layouts/SideMenu.js.map +1 -0
- package/lib/module/Mock/Layouts/StackNode.js +12 -0
- package/lib/module/Mock/Layouts/StackNode.js.map +1 -0
- package/lib/module/Mock/Stores/EventsStore.js +53 -0
- package/lib/module/Mock/Stores/EventsStore.js.map +1 -0
- package/lib/module/Mock/Stores/LayoutStore.js +176 -0
- package/lib/module/Mock/Stores/LayoutStore.js.map +1 -0
- package/lib/module/Mock/actions/layoutActions.js +19 -0
- package/lib/module/Mock/actions/layoutActions.js.map +1 -0
- package/lib/module/Mock/connect.js +8 -0
- package/lib/module/Mock/connect.js.map +1 -0
- package/lib/module/Mock/constants.js +5 -0
- package/lib/module/Mock/constants.js.map +1 -0
- package/lib/module/Mock/index.js +20 -0
- package/lib/module/Mock/index.js.map +1 -0
- package/lib/module/Mock/mocks/AppRegistryService.js +6 -0
- package/lib/module/Mock/mocks/AppRegistryService.js.map +1 -0
- package/lib/module/Mock/mocks/NativeCommandsSender.js +146 -0
- package/lib/module/Mock/mocks/NativeCommandsSender.js.map +1 -0
- package/lib/module/Mock/mocks/NativeEventsReceiver.js +103 -0
- package/lib/module/Mock/mocks/NativeEventsReceiver.js.map +1 -0
- package/lib/typescript/Mock/Application.d.ts.map +1 -1
- package/lib/typescript/Mock/ComponentProps.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/BottomTabs.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/ComponentScreen.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/LayoutComponent.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/Modals.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/NavigationButton.d.ts +1 -1
- package/lib/typescript/Mock/Components/NavigationButton.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/Overlays.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/SideMenu.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/Stack.d.ts.map +1 -1
- package/lib/typescript/Mock/Components/TopBar.d.ts +1 -1
- package/lib/typescript/Mock/Components/TopBar.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/BottomTabsNode.d.ts +1 -1
- package/lib/typescript/Mock/Layouts/BottomTabsNode.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/ComponentNode.d.ts +1 -1
- package/lib/typescript/Mock/Layouts/ComponentNode.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/LayoutNodeFactory.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/Node.d.ts +1 -1
- package/lib/typescript/Mock/Layouts/Node.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/ParentNode.d.ts +2 -2
- package/lib/typescript/Mock/Layouts/ParentNode.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/SideMenu.d.ts +1 -1
- package/lib/typescript/Mock/Layouts/SideMenu.d.ts.map +1 -1
- package/lib/typescript/Mock/Layouts/StackNode.d.ts.map +1 -1
- package/lib/typescript/Mock/Stores/EventsStore.d.ts +3 -3
- package/lib/typescript/Mock/Stores/EventsStore.d.ts.map +1 -1
- package/lib/typescript/Mock/Stores/LayoutStore.d.ts.map +1 -1
- package/lib/typescript/Mock/actions/layoutActions.d.ts.map +1 -1
- package/lib/typescript/Mock/connect.d.ts.map +1 -1
- package/lib/typescript/Mock/constants.d.ts.map +1 -1
- package/lib/typescript/Mock/index.d.ts.map +1 -1
- package/lib/typescript/Mock/mocks/AppRegistryService.d.ts.map +1 -1
- package/lib/typescript/Mock/mocks/NativeCommandsSender.d.ts +2 -2
- package/lib/typescript/Mock/mocks/NativeCommandsSender.d.ts.map +1 -1
- package/lib/typescript/Mock/mocks/NativeEventsReceiver.d.ts +2 -2
- package/lib/typescript/Mock/mocks/NativeEventsReceiver.d.ts.map +1 -1
- package/lib/typescript/Navigation.d.ts.map +1 -0
- package/lib/typescript/NavigationDelegate.d.ts.map +1 -0
- package/lib/typescript/adapters/AppRegistryService.d.ts.map +1 -0
- package/lib/typescript/adapters/AssetResolver.d.ts.map +1 -0
- package/lib/typescript/adapters/ColorService.d.ts.map +1 -0
- package/lib/typescript/adapters/Constants.d.ts.map +1 -0
- package/lib/typescript/adapters/NativeCommandsSender.d.ts.map +1 -0
- package/lib/typescript/adapters/NativeEventsReceiver.d.ts.map +1 -0
- package/lib/typescript/adapters/NativeEventsReceiver.mock.d.ts.map +1 -0
- package/lib/typescript/adapters/NativeRNNTurboEventEmitter.d.ts.map +1 -0
- package/lib/typescript/adapters/NativeRNNTurboModule.d.ts.map +1 -0
- package/lib/typescript/adapters/TouchablePreview.d.ts.map +1 -0
- package/lib/typescript/adapters/UniqueIdProvider.d.ts.map +1 -0
- package/lib/typescript/commands/Commands.d.ts.map +1 -0
- package/lib/typescript/commands/Commands.test.d.ts.map +1 -0
- package/lib/typescript/commands/Deprecations.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutTreeCrawler.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutTreeCrawler.test.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutTreeParser.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutTreeParser.test.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutType.d.ts.map +1 -0
- package/lib/typescript/commands/LayoutType.test.d.ts.map +1 -0
- package/lib/typescript/commands/OptionsCrawler.d.ts.map +1 -0
- package/lib/typescript/commands/OptionsCrawler.test.d.ts.map +1 -0
- package/lib/typescript/commands/OptionsProcessor.d.ts.map +1 -0
- package/lib/typescript/commands/OptionsProcessor.test.d.ts.map +1 -0
- package/lib/typescript/components/ComponentRegistry.d.ts.map +1 -0
- package/lib/typescript/components/ComponentRegistry.test.d.ts.map +1 -0
- package/lib/typescript/components/ComponentWrapper.d.ts.map +1 -0
- package/lib/typescript/components/ComponentWrapper.test.d.ts.map +1 -0
- package/lib/typescript/components/Modal.d.ts.map +1 -0
- package/lib/typescript/components/Store.d.ts.map +1 -0
- package/lib/typescript/components/Store.test.d.ts.map +1 -0
- package/lib/typescript/events/CommandsObserver.d.ts.map +1 -0
- package/lib/typescript/events/CommandsObserver.test.d.ts.map +1 -0
- package/lib/typescript/events/ComponentEventsObserver.d.ts.map +1 -0
- package/lib/typescript/events/ComponentEventsObserver.test.d.ts.map +1 -0
- package/lib/typescript/events/EventsRegistry.d.ts.map +1 -0
- package/lib/typescript/events/EventsRegistry.test.d.ts.map +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/interfaces/CommandName.d.ts.map +1 -0
- package/lib/typescript/interfaces/ComponentEvents.d.ts.map +1 -0
- package/lib/typescript/interfaces/EventSubscription.d.ts.map +1 -0
- package/lib/typescript/interfaces/Events.d.ts.map +1 -0
- package/lib/typescript/interfaces/Layout.d.ts.map +1 -0
- package/lib/typescript/interfaces/NavigationComponent.d.ts.map +1 -0
- package/lib/typescript/interfaces/NavigationComponentListener.d.ts.map +1 -0
- package/lib/typescript/interfaces/NavigationComponentProps.d.ts.map +1 -0
- package/lib/typescript/interfaces/NavigationFunctionComponent.d.ts.map +1 -0
- package/lib/typescript/interfaces/Options.d.ts.map +1 -0
- package/lib/typescript/interfaces/ProcessorSubscription.d.ts.map +1 -0
- package/lib/typescript/interfaces/Processors.d.ts.map +1 -0
- package/lib/typescript/processors/LayoutProcessor.d.ts.map +1 -0
- package/lib/typescript/processors/LayoutProcessor.test.d.ts.map +1 -0
- package/lib/typescript/processors/LayoutProcessorsStore.d.ts.map +1 -0
- package/lib/typescript/processors/LayoutProcessorsStore.test.d.ts.map +1 -0
- package/lib/typescript/processors/OptionProcessorsStore.d.ts.map +1 -0
- package/lib/typescript/processors/OptionProcessorsStore.test.d.ts.map +1 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +12 -6
- package/src/Mock/Application.tsx +30 -0
- package/src/Mock/ComponentProps.tsx +6 -0
- package/src/Mock/Components/BottomTabs.tsx +14 -0
- package/src/Mock/Components/ComponentScreen.tsx +107 -0
- package/src/Mock/Components/LayoutComponent.tsx +37 -0
- package/src/Mock/Components/Modals.tsx +22 -0
- package/src/Mock/Components/NavigationButton.tsx +86 -0
- package/src/Mock/Components/Overlays.tsx +23 -0
- package/src/Mock/Components/SideMenu.tsx +27 -0
- package/src/Mock/Components/Stack.tsx +16 -0
- package/src/Mock/Components/TopBar.tsx +96 -0
- package/src/Mock/Layouts/BottomTabsNode.ts +34 -0
- package/src/Mock/Layouts/ComponentNode.ts +124 -0
- package/src/Mock/Layouts/LayoutNodeFactory.ts +31 -0
- package/src/Mock/Layouts/Node.ts +35 -0
- package/src/Mock/Layouts/ParentNode.ts +86 -0
- package/src/Mock/Layouts/SideMenu.ts +87 -0
- package/src/Mock/Layouts/StackNode.ts +11 -0
- package/src/Mock/Stores/EventsStore.ts +68 -0
- package/src/Mock/Stores/LayoutStore.ts +200 -0
- package/src/Mock/actions/layoutActions.ts +21 -0
- package/src/Mock/connect.ts +6 -0
- package/src/Mock/constants.ts +2 -0
- package/src/Mock/index.ts +16 -0
- package/src/Mock/mocks/AppRegistryService.ts +5 -0
- package/src/Mock/mocks/NativeCommandsSender.tsx +168 -0
- package/src/Mock/mocks/NativeEventsReceiver.ts +162 -0
- package/lib/typescript/src/Navigation.d.ts.map +0 -1
- package/lib/typescript/src/NavigationDelegate.d.ts.map +0 -1
- package/lib/typescript/src/adapters/AppRegistryService.d.ts.map +0 -1
- package/lib/typescript/src/adapters/AssetResolver.d.ts.map +0 -1
- package/lib/typescript/src/adapters/ColorService.d.ts.map +0 -1
- package/lib/typescript/src/adapters/Constants.d.ts.map +0 -1
- package/lib/typescript/src/adapters/NativeCommandsSender.d.ts.map +0 -1
- package/lib/typescript/src/adapters/NativeEventsReceiver.d.ts.map +0 -1
- package/lib/typescript/src/adapters/NativeEventsReceiver.mock.d.ts.map +0 -1
- package/lib/typescript/src/adapters/NativeRNNTurboEventEmitter.d.ts.map +0 -1
- package/lib/typescript/src/adapters/NativeRNNTurboModule.d.ts.map +0 -1
- package/lib/typescript/src/adapters/TouchablePreview.d.ts.map +0 -1
- package/lib/typescript/src/adapters/UniqueIdProvider.d.ts.map +0 -1
- package/lib/typescript/src/commands/Commands.d.ts.map +0 -1
- package/lib/typescript/src/commands/Commands.test.d.ts.map +0 -1
- package/lib/typescript/src/commands/Deprecations.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutTreeCrawler.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutTreeCrawler.test.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutTreeParser.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutTreeParser.test.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutType.d.ts.map +0 -1
- package/lib/typescript/src/commands/LayoutType.test.d.ts.map +0 -1
- package/lib/typescript/src/commands/OptionsCrawler.d.ts.map +0 -1
- package/lib/typescript/src/commands/OptionsCrawler.test.d.ts.map +0 -1
- package/lib/typescript/src/commands/OptionsProcessor.d.ts.map +0 -1
- package/lib/typescript/src/commands/OptionsProcessor.test.d.ts.map +0 -1
- package/lib/typescript/src/components/ComponentRegistry.d.ts.map +0 -1
- package/lib/typescript/src/components/ComponentRegistry.test.d.ts.map +0 -1
- package/lib/typescript/src/components/ComponentWrapper.d.ts.map +0 -1
- package/lib/typescript/src/components/ComponentWrapper.test.d.ts.map +0 -1
- package/lib/typescript/src/components/Modal.d.ts.map +0 -1
- package/lib/typescript/src/components/Store.d.ts.map +0 -1
- package/lib/typescript/src/components/Store.test.d.ts.map +0 -1
- package/lib/typescript/src/events/CommandsObserver.d.ts.map +0 -1
- package/lib/typescript/src/events/CommandsObserver.test.d.ts.map +0 -1
- package/lib/typescript/src/events/ComponentEventsObserver.d.ts.map +0 -1
- package/lib/typescript/src/events/ComponentEventsObserver.test.d.ts.map +0 -1
- package/lib/typescript/src/events/EventsRegistry.d.ts.map +0 -1
- package/lib/typescript/src/events/EventsRegistry.test.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/CommandName.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/ComponentEvents.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/EventSubscription.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/Events.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/Layout.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/NavigationComponent.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/NavigationComponentListener.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/NavigationComponentProps.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/NavigationFunctionComponent.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/Options.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/ProcessorSubscription.d.ts.map +0 -1
- package/lib/typescript/src/interfaces/Processors.d.ts.map +0 -1
- package/lib/typescript/src/processors/LayoutProcessor.d.ts.map +0 -1
- package/lib/typescript/src/processors/LayoutProcessor.test.d.ts.map +0 -1
- package/lib/typescript/src/processors/LayoutProcessorsStore.d.ts.map +0 -1
- package/lib/typescript/src/processors/LayoutProcessorsStore.test.d.ts.map +0 -1
- package/lib/typescript/src/processors/OptionProcessorsStore.d.ts.map +0 -1
- package/lib/typescript/src/processors/OptionProcessorsStore.test.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- /package/lib/typescript/{src/Navigation.d.ts → Navigation.d.ts} +0 -0
- /package/lib/typescript/{src/NavigationDelegate.d.ts → NavigationDelegate.d.ts} +0 -0
- /package/lib/typescript/{src/adapters → adapters}/AppRegistryService.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/AssetResolver.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/ColorService.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/Constants.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/NativeCommandsSender.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/NativeEventsReceiver.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/NativeEventsReceiver.mock.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/NativeRNNTurboEventEmitter.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/NativeRNNTurboModule.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/TouchablePreview.d.ts +0 -0
- /package/lib/typescript/{src/adapters → adapters}/UniqueIdProvider.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/Commands.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/Commands.test.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/Deprecations.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutTreeCrawler.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutTreeCrawler.test.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutTreeParser.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutTreeParser.test.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutType.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/LayoutType.test.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/OptionsCrawler.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/OptionsCrawler.test.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/OptionsProcessor.d.ts +0 -0
- /package/lib/typescript/{src/commands → commands}/OptionsProcessor.test.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/ComponentRegistry.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/ComponentRegistry.test.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/ComponentWrapper.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/ComponentWrapper.test.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Modal.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Store.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Store.test.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/CommandsObserver.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/CommandsObserver.test.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/ComponentEventsObserver.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/ComponentEventsObserver.test.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/EventsRegistry.d.ts +0 -0
- /package/lib/typescript/{src/events → events}/EventsRegistry.test.d.ts +0 -0
- /package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/CommandName.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/ComponentEvents.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/EventSubscription.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/Events.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/Layout.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/NavigationComponent.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/NavigationComponentListener.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/NavigationComponentProps.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/NavigationFunctionComponent.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/Options.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/ProcessorSubscription.d.ts +0 -0
- /package/lib/typescript/{src/interfaces → interfaces}/Processors.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/LayoutProcessor.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/LayoutProcessor.test.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/LayoutProcessorsStore.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/LayoutProcessorsStore.test.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/OptionProcessorsStore.d.ts +0 -0
- /package/lib/typescript/{src/processors → processors}/OptionProcessorsStore.test.d.ts +0 -0
- /package/lib/typescript/{src/types.d.ts → types.d.ts} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { connect } from './connect';
|
|
4
|
+
|
|
5
|
+
interface ApplicationProps {
|
|
6
|
+
entryPoint: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Application = connect(
|
|
10
|
+
class extends React.Component<ApplicationProps> {
|
|
11
|
+
constructor(props: ApplicationProps) {
|
|
12
|
+
super(props);
|
|
13
|
+
props.entryPoint();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
render() {
|
|
17
|
+
const { LayoutComponent } = require('./Components/LayoutComponent');
|
|
18
|
+
const { LayoutStore } = require('./Stores/LayoutStore');
|
|
19
|
+
const { Modals } = require('./Components/Modals');
|
|
20
|
+
const { Overlays } = require('./Components/Overlays');
|
|
21
|
+
return (
|
|
22
|
+
<View testID={'Application'}>
|
|
23
|
+
<LayoutComponent layoutNode={LayoutStore.getLayout()} />
|
|
24
|
+
<Modals />
|
|
25
|
+
<Overlays />
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { LayoutComponent } from './LayoutComponent';
|
|
3
|
+
import { ComponentProps } from '../ComponentProps';
|
|
4
|
+
import { connect } from '../connect';
|
|
5
|
+
|
|
6
|
+
export const BottomTabs = connect(
|
|
7
|
+
class extends Component<ComponentProps> {
|
|
8
|
+
render() {
|
|
9
|
+
return this.props.layoutNode.children.map((child) => {
|
|
10
|
+
return <LayoutComponent key={child.nodeId} layoutNode={child} />;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, Image, ImageURISource } from 'react-native';
|
|
3
|
+
import { Navigation, ImageResource } from 'react-native-navigation';
|
|
4
|
+
import { ComponentProps } from '../ComponentProps';
|
|
5
|
+
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
|
|
6
|
+
import { LayoutStore } from '../Stores/LayoutStore';
|
|
7
|
+
import { connect } from '../connect';
|
|
8
|
+
import { TopBar } from './TopBar';
|
|
9
|
+
import { events } from '../Stores/EventsStore';
|
|
10
|
+
import _ from 'lodash';
|
|
11
|
+
import { switchTabByIndex } from '../actions/layoutActions';
|
|
12
|
+
|
|
13
|
+
function isURISource(src: ImageResource | undefined): src is ImageURISource {
|
|
14
|
+
return !!src && typeof src === 'object' && 'uri' in src;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ComponentScreen = connect(
|
|
18
|
+
class extends Component<ComponentProps> {
|
|
19
|
+
constructor(props: ComponentProps) {
|
|
20
|
+
super(props);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
componentDidMount() {
|
|
24
|
+
this.props.layoutNode.componentDidMount();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
isVisible(): boolean {
|
|
28
|
+
const isVisible = LayoutStore.isVisibleLayout(this.props.layoutNode);
|
|
29
|
+
return isVisible;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
renderTabBar() {
|
|
33
|
+
const bottomTabs = this.props.layoutNode.getBottomTabs();
|
|
34
|
+
if (!bottomTabs) return null;
|
|
35
|
+
const bottomTabsOptions = bottomTabs.resolveOptions().bottomTabs;
|
|
36
|
+
if (bottomTabsOptions?.visible === false) return null;
|
|
37
|
+
const buttons = bottomTabs!.children!.map((child, i) => {
|
|
38
|
+
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
39
|
+
const icon =
|
|
40
|
+
(bottomTabs as any).selectedIndex === i
|
|
41
|
+
? bottomTabOptions?.selectedIcon
|
|
42
|
+
: bottomTabOptions?.icon;
|
|
43
|
+
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
44
|
+
return (
|
|
45
|
+
<View key={`tab-${i}`}>
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
style={{ padding: 10 }}
|
|
48
|
+
testID={bottomTabOptions?.testID}
|
|
49
|
+
onPress={() => {
|
|
50
|
+
events.invokeBottomTabPressed({
|
|
51
|
+
tabIndex: i,
|
|
52
|
+
});
|
|
53
|
+
if (_.defaultTo(bottomTabOptions?.selectTabOnPress, true))
|
|
54
|
+
switchTabByIndex(this.props.layoutNode.getBottomTabs(), i);
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
|
58
|
+
<Text>{bottomTabOptions?.badge}</Text>
|
|
59
|
+
{iconURI && (
|
|
60
|
+
<Image
|
|
61
|
+
style={{ width: 18, height: 18, marginBottom: 5 }}
|
|
62
|
+
source={{ uri: iconURI }}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
<Text style={{ fontSize: 12 }}>{bottomTabOptions?.text || ''}</Text>
|
|
66
|
+
</View>
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<View
|
|
74
|
+
testID={bottomTabsOptions?.testID}
|
|
75
|
+
style={{
|
|
76
|
+
flexDirection: 'row',
|
|
77
|
+
justifyContent: 'center',
|
|
78
|
+
width: '100%',
|
|
79
|
+
backgroundColor: '#F0F2F5',
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{buttons}
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
render() {
|
|
88
|
+
const Component = Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
|
|
89
|
+
if (!Component)
|
|
90
|
+
throw new Error(`${this.props.layoutNode.data.name} has not been registered.`);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View testID={this.isVisible() ? VISIBLE_SCREEN_TEST_ID : undefined}>
|
|
94
|
+
{this.props.layoutNode.getStack() && (
|
|
95
|
+
<TopBar
|
|
96
|
+
layoutNode={this.props.layoutNode}
|
|
97
|
+
topBarOptions={this.props.layoutNode.resolveOptions().topBar}
|
|
98
|
+
backButtonOptions={this.props.layoutNode.resolveOptions().topBar?.backButton}
|
|
99
|
+
/>
|
|
100
|
+
)}
|
|
101
|
+
<Component componentId={this.props.layoutNode.nodeId} />
|
|
102
|
+
{this.renderTabBar()}
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { BottomTabs } from './BottomTabs';
|
|
4
|
+
import { ComponentProps } from '../ComponentProps';
|
|
5
|
+
import { ComponentScreen } from './ComponentScreen';
|
|
6
|
+
import { Stack } from './Stack';
|
|
7
|
+
import { SideMenuRoot, SideMenuCenter, SideMenuLeft, SideMenuRight } from './SideMenu';
|
|
8
|
+
|
|
9
|
+
export const LayoutComponent = class extends Component<ComponentProps> {
|
|
10
|
+
render() {
|
|
11
|
+
switch (this.props.layoutNode.type) {
|
|
12
|
+
case 'BottomTabs':
|
|
13
|
+
return <BottomTabs layoutNode={this.props.layoutNode} />;
|
|
14
|
+
case 'Stack':
|
|
15
|
+
return <Stack layoutNode={this.props.layoutNode} />;
|
|
16
|
+
case 'Component':
|
|
17
|
+
return <ComponentScreen layoutNode={this.props.layoutNode} />;
|
|
18
|
+
case 'SideMenuRoot':
|
|
19
|
+
return <SideMenuRoot layoutNode={this.props.layoutNode} />;
|
|
20
|
+
case 'SideMenuLeft':
|
|
21
|
+
return <SideMenuLeft layoutNode={this.props.layoutNode} />;
|
|
22
|
+
case 'SideMenuCenter':
|
|
23
|
+
return <SideMenuCenter layoutNode={this.props.layoutNode} />;
|
|
24
|
+
case 'SideMenuRight':
|
|
25
|
+
return <SideMenuRight layoutNode={this.props.layoutNode} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return <View />;
|
|
29
|
+
}
|
|
30
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
31
|
+
const err = new Error(
|
|
32
|
+
`Error while trying to render layout ${this.props.layoutNode.nodeId} of type ${this.props.layoutNode.type}: ${error}\n${errorInfo?.componentStack}`
|
|
33
|
+
);
|
|
34
|
+
(err as any).cause = error;
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { ComponentProps } from '../ComponentProps';
|
|
4
|
+
import { LayoutComponent } from './LayoutComponent';
|
|
5
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
6
|
+
import { LayoutStore } from '../Stores/LayoutStore';
|
|
7
|
+
import { connect } from '../connect';
|
|
8
|
+
|
|
9
|
+
export const Modals = connect(
|
|
10
|
+
class extends Component<ComponentProps> {
|
|
11
|
+
render() {
|
|
12
|
+
const children = LayoutStore.getModals();
|
|
13
|
+
return (
|
|
14
|
+
<View testID={'MODALS'}>
|
|
15
|
+
{children.map((child: ParentNode) => {
|
|
16
|
+
return <LayoutComponent key={child.nodeId} layoutNode={child} />;
|
|
17
|
+
})}
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Button, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Navigation, OptionsTopBarButton } from 'react-native-navigation';
|
|
4
|
+
import { events } from '../Stores/EventsStore';
|
|
5
|
+
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
button: OptionsTopBarButton;
|
|
8
|
+
componentId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const NavigationButton = class extends Component<ButtonProps> {
|
|
12
|
+
ref = undefined;
|
|
13
|
+
render() {
|
|
14
|
+
const { button, componentId } = this.props;
|
|
15
|
+
if (button.component) return this.renderButtonComponent();
|
|
16
|
+
return (
|
|
17
|
+
<Button
|
|
18
|
+
testID={button.testID}
|
|
19
|
+
key={button.id}
|
|
20
|
+
title={button.text || ''}
|
|
21
|
+
disabled={button.enabled === false}
|
|
22
|
+
onPress={() =>
|
|
23
|
+
button.enabled !== false &&
|
|
24
|
+
events.invokeNavigationButtonPressed({
|
|
25
|
+
buttonId: button.id,
|
|
26
|
+
componentId,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
renderButtonComponent() {
|
|
34
|
+
const { button, componentId } = this.props;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
const buttonComponentId = button.component!.componentId;
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const ComponentClass = Navigation.mock.store.getComponentClassForName(button.component.name);
|
|
39
|
+
if (!ComponentClass) {
|
|
40
|
+
throw new Error(`Cannot find registered component for: ${button.component?.name}`);
|
|
41
|
+
}
|
|
42
|
+
const ButtonComponent = ComponentClass();
|
|
43
|
+
const props = Navigation.mock.store.getPropsForId(buttonComponentId);
|
|
44
|
+
return (
|
|
45
|
+
<TouchableOpacity
|
|
46
|
+
onPress={() => {
|
|
47
|
+
if (this.ref) {
|
|
48
|
+
this.invokeOnClick(
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
(this.ref!._reactInternalFiber || this.ref!._reactInternals).return.stateNode
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
events.invokeNavigationButtonPressed({
|
|
55
|
+
buttonId: button.id,
|
|
56
|
+
componentId: componentId,
|
|
57
|
+
});
|
|
58
|
+
}}
|
|
59
|
+
testID={button.testID}
|
|
60
|
+
>
|
|
61
|
+
<ButtonComponent
|
|
62
|
+
key={buttonComponentId}
|
|
63
|
+
{...props}
|
|
64
|
+
componentId={buttonComponentId}
|
|
65
|
+
ref={(ref: any) => (this.ref = ref)}
|
|
66
|
+
/>
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
invokeOnClick(stateNode: any) {
|
|
72
|
+
if (stateNode.children) {
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
stateNode.children.forEach((instance) => {
|
|
75
|
+
if (
|
|
76
|
+
instance.internalInstanceHandle &&
|
|
77
|
+
instance.internalInstanceHandle.stateNode.props.onClick
|
|
78
|
+
) {
|
|
79
|
+
instance.internalInstanceHandle.stateNode.props.onClick();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.invokeOnClick(instance);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { ComponentProps } from '../ComponentProps';
|
|
4
|
+
import { VISIBLE_OVERLAY_TEST_ID } from '../constants';
|
|
5
|
+
import { LayoutComponent } from './LayoutComponent';
|
|
6
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
7
|
+
import { LayoutStore } from '../Stores/LayoutStore';
|
|
8
|
+
import { connect } from '../connect';
|
|
9
|
+
|
|
10
|
+
export const Overlays = connect(
|
|
11
|
+
class extends Component<ComponentProps> {
|
|
12
|
+
render() {
|
|
13
|
+
const children = LayoutStore.getOverlays();
|
|
14
|
+
return (
|
|
15
|
+
<View testID={VISIBLE_OVERLAY_TEST_ID}>
|
|
16
|
+
{children.map((child: ParentNode) => {
|
|
17
|
+
return <LayoutComponent key={child.nodeId} layoutNode={child} />;
|
|
18
|
+
})}
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { connect } from '../connect';
|
|
3
|
+
import { ComponentProps } from '../ComponentProps';
|
|
4
|
+
import { LayoutComponent } from './LayoutComponent';
|
|
5
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
6
|
+
|
|
7
|
+
export const SideMenuRoot = connect(
|
|
8
|
+
class extends Component<ComponentProps> {
|
|
9
|
+
render() {
|
|
10
|
+
const children = this.props.layoutNode.children;
|
|
11
|
+
return children.map((child: ParentNode) => {
|
|
12
|
+
return <LayoutComponent key={child.nodeId} layoutNode={child} />;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const SideMenuComponent = connect(class extends Component<ComponentProps> {
|
|
19
|
+
render() {
|
|
20
|
+
const children = this.props.layoutNode.children;
|
|
21
|
+
const component = children[0];
|
|
22
|
+
return <LayoutComponent key={component.nodeId} layoutNode={component} />;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export const SideMenuLeft = SideMenuComponent;
|
|
26
|
+
export const SideMenuCenter = SideMenuComponent;
|
|
27
|
+
export const SideMenuRight = SideMenuComponent;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { ComponentProps } from '../ComponentProps';
|
|
3
|
+
import { LayoutComponent } from './LayoutComponent';
|
|
4
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
5
|
+
import { connect } from '../connect';
|
|
6
|
+
|
|
7
|
+
export const Stack = connect(
|
|
8
|
+
class extends Component<ComponentProps> {
|
|
9
|
+
render() {
|
|
10
|
+
const children = this.props.layoutNode.children;
|
|
11
|
+
return children.map((child: ParentNode, i: number) => {
|
|
12
|
+
return <LayoutComponent key={child.nodeId} layoutNode={child} backButton={i > 0} />;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Button, View, Text } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
Navigation,
|
|
5
|
+
OptionsTopBar,
|
|
6
|
+
OptionsTopBarBackButton,
|
|
7
|
+
OptionsTopBarButton,
|
|
8
|
+
} from 'react-native-navigation';
|
|
9
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
10
|
+
import { LayoutStore } from '../Stores/LayoutStore';
|
|
11
|
+
import { NavigationButton } from './NavigationButton';
|
|
12
|
+
import { events } from '../Stores/EventsStore';
|
|
13
|
+
|
|
14
|
+
const DEFAULT_BACK_BUTTON_ID = 'RNN.back';
|
|
15
|
+
|
|
16
|
+
export interface TopBarProps {
|
|
17
|
+
layoutNode: ParentNode;
|
|
18
|
+
topBarOptions?: OptionsTopBar;
|
|
19
|
+
backButtonOptions?: OptionsTopBarBackButton;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const TopBar = class extends Component<TopBarProps> {
|
|
23
|
+
constructor(props: TopBarProps) {
|
|
24
|
+
super(props);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
render() {
|
|
28
|
+
const topBarOptions = this.props.topBarOptions;
|
|
29
|
+
const topbarTestId = topBarOptions?.testID;
|
|
30
|
+
const titleTestId = topbarTestId ? { testID: `${topbarTestId}.title` } : {};
|
|
31
|
+
const subtitleTestId = topbarTestId ? { testID: `${topbarTestId}.subtitle` } : {};
|
|
32
|
+
if (topBarOptions?.visible === false) return null;
|
|
33
|
+
else {
|
|
34
|
+
const component = topBarOptions?.title?.component;
|
|
35
|
+
return (
|
|
36
|
+
<View testID={topbarTestId}>
|
|
37
|
+
<Text {...titleTestId}>{topBarOptions?.title?.text}</Text>
|
|
38
|
+
<Text {...subtitleTestId}>{topBarOptions?.subtitle?.text}</Text>
|
|
39
|
+
{this.renderButtons(topBarOptions?.leftButtons)}
|
|
40
|
+
{this.renderButtons(topBarOptions?.rightButtons)}
|
|
41
|
+
{component &&
|
|
42
|
+
//@ts-ignore
|
|
43
|
+
this.renderComponent(component.componentId!, component.name)}
|
|
44
|
+
{this.shouldRenderBackButton(this.props.layoutNode) && this.renderBackButton()}
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
shouldRenderBackButton(layoutNode: ParentNode) {
|
|
51
|
+
const backButtonVisible = layoutNode.resolveOptions().topBar?.backButton?.visible;
|
|
52
|
+
return layoutNode.getStack()!.children.length > 1 && backButtonVisible !== false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
renderButtons(buttons: OptionsTopBarButton[] = []) {
|
|
56
|
+
return buttons.map((button, i: number) => {
|
|
57
|
+
return (
|
|
58
|
+
<NavigationButton
|
|
59
|
+
button={button}
|
|
60
|
+
key={button.id || i}
|
|
61
|
+
componentId={this.props.layoutNode.nodeId}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
renderBackButton() {
|
|
68
|
+
const backButtonOptions = this.props.backButtonOptions;
|
|
69
|
+
return (
|
|
70
|
+
<Button
|
|
71
|
+
testID={backButtonOptions?.testID}
|
|
72
|
+
title={backButtonOptions && backButtonOptions.title ? backButtonOptions.title : ''}
|
|
73
|
+
onPress={() => {
|
|
74
|
+
if (backButtonOptions?.popStackOnPress === false) {
|
|
75
|
+
events.invokeNavigationButtonPressed({
|
|
76
|
+
buttonId: backButtonOptions?.id || DEFAULT_BACK_BUTTON_ID,
|
|
77
|
+
componentId: this.props.layoutNode.nodeId,
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
LayoutStore.pop(this.props.layoutNode.nodeId);
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
renderComponent(id: string, name: string, testID?: string) {
|
|
88
|
+
const Component = Navigation.mock.store.getComponentClassForName(name)!();
|
|
89
|
+
const props = Navigation.mock.store.getPropsForId(id);
|
|
90
|
+
return (
|
|
91
|
+
<View key={id} testID={testID}>
|
|
92
|
+
<Component {...props} componentId={id} />
|
|
93
|
+
</View>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { Options } from '../../index';
|
|
3
|
+
import { switchTabByIndex } from '../actions/layoutActions';
|
|
4
|
+
import ParentNode from './ParentNode';
|
|
5
|
+
|
|
6
|
+
export default class BottomTabsNode extends ParentNode {
|
|
7
|
+
selectedIndex: number;
|
|
8
|
+
constructor(layout: any, parentNode?: ParentNode) {
|
|
9
|
+
super(layout, 'BottomTabs', parentNode);
|
|
10
|
+
this.selectedIndex = layout.data?.options?.bottomTabs?.currentTabIndex || 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
mergeOptions(_options: Options) {
|
|
14
|
+
super.mergeOptions(_options);
|
|
15
|
+
|
|
16
|
+
const { options } = this.data;
|
|
17
|
+
if (options.bottomTabs?.currentTabIndex) {
|
|
18
|
+
this.selectedIndex = options.bottomTabs?.currentTabIndex;
|
|
19
|
+
switchTabByIndex(this, this.selectedIndex);
|
|
20
|
+
}
|
|
21
|
+
if (options.bottomTabs?.currentTabId) {
|
|
22
|
+
const index = _.findIndex(
|
|
23
|
+
this.children,
|
|
24
|
+
(child) => child.nodeId === options?.bottomTabs?.currentTabId
|
|
25
|
+
);
|
|
26
|
+
if (index !== -1) this.selectedIndex = index;
|
|
27
|
+
switchTabByIndex(this, this.selectedIndex);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getVisibleLayout() {
|
|
32
|
+
return this.children[this.selectedIndex].getVisibleLayout();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { OptionsTopBarButton } from '../../index';
|
|
3
|
+
import { events } from '../Stores/EventsStore';
|
|
4
|
+
import ParentNode from './ParentNode';
|
|
5
|
+
|
|
6
|
+
export default class ComponentNode extends ParentNode {
|
|
7
|
+
componentDidMountOnce = false;
|
|
8
|
+
componentDidAppearPending = false;
|
|
9
|
+
|
|
10
|
+
constructor(layout: any, parentNode?: ParentNode) {
|
|
11
|
+
super(layout, 'Component', parentNode);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public componentDidMount() {
|
|
15
|
+
this.componentDidMountOnce = true;
|
|
16
|
+
this.componentDidAppearPending && setImmediate(() => this.componentDidAppear());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public componentDidAppear() {
|
|
20
|
+
if (this.componentDidMountOnce) {
|
|
21
|
+
events.invokeComponentWillAppear({
|
|
22
|
+
componentName: this.data.name,
|
|
23
|
+
componentId: this.nodeId,
|
|
24
|
+
componentType: 'Component',
|
|
25
|
+
});
|
|
26
|
+
events.invokeComponentDidAppear({
|
|
27
|
+
componentName: this.data.name,
|
|
28
|
+
componentId: this.nodeId,
|
|
29
|
+
componentType: 'Component',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
this.buttonsDidAppear(
|
|
33
|
+
_.concat(
|
|
34
|
+
this.data.options.topBar?.rightButtons || [],
|
|
35
|
+
this.data.options.topBar?.leftButtons || []
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
this.titleChanged(undefined, this.data.options.topBar?.title);
|
|
39
|
+
} else {
|
|
40
|
+
this.componentDidAppearPending = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public componentDidDisappear() {
|
|
45
|
+
events.invokeComponentDidDisappear({
|
|
46
|
+
componentName: this.data.name,
|
|
47
|
+
componentId: this.nodeId,
|
|
48
|
+
componentType: 'Component',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
this.buttonsDidDisappear(
|
|
52
|
+
_.concat(
|
|
53
|
+
this.data.options.topBar?.rightButtons || [],
|
|
54
|
+
this.data.options.topBar?.leftButtons || []
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
this.titleChanged(this.data.options.topBar?.title);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
titleChanged(oldTitle: any, newTitle?: any) {
|
|
61
|
+
if (oldTitle && oldTitle.component) {
|
|
62
|
+
events.invokeComponentDidDisappear({
|
|
63
|
+
componentName: oldTitle.component.name,
|
|
64
|
+
componentId: oldTitle.component.componentId,
|
|
65
|
+
componentType: 'TopBarTitle',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (newTitle && newTitle.component) {
|
|
70
|
+
events.invokeComponentWillAppear({
|
|
71
|
+
componentName: newTitle.component.name,
|
|
72
|
+
componentId: newTitle.component.componentId,
|
|
73
|
+
componentType: 'TopBarTitle',
|
|
74
|
+
});
|
|
75
|
+
events.invokeComponentDidAppear({
|
|
76
|
+
componentName: newTitle.component.name,
|
|
77
|
+
componentId: newTitle.component.componentId,
|
|
78
|
+
componentType: 'TopBarTitle',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
buttonsChanged(oldButtons: OptionsTopBarButton[], newButtons: OptionsTopBarButton[]) {
|
|
84
|
+
this.buttonsDidDisappear(oldButtons);
|
|
85
|
+
this.buttonsDidAppear(newButtons);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
buttonsDidAppear(buttons: OptionsTopBarButton[] = []) {
|
|
89
|
+
buttons.forEach((button: OptionsTopBarButton) => {
|
|
90
|
+
if (button.component) {
|
|
91
|
+
events.invokeComponentWillAppear({
|
|
92
|
+
componentName: button.component.name,
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
componentId: button.component.componentId,
|
|
95
|
+
componentType: 'TopBarButton',
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
events.invokeComponentDidAppear({
|
|
99
|
+
componentName: button.component.name,
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
componentId: button.component.componentId,
|
|
102
|
+
componentType: 'TopBarButton',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
buttonsDidDisappear(buttons: OptionsTopBarButton[] = []) {
|
|
109
|
+
buttons.forEach((button: OptionsTopBarButton) => {
|
|
110
|
+
if (button.component) {
|
|
111
|
+
events.invokeComponentDidDisappear({
|
|
112
|
+
componentName: button.component.name,
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
componentId: button.component.componentId,
|
|
115
|
+
componentType: 'TopBarButton',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getVisibleLayout() {
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BottomTabs from './BottomTabsNode';
|
|
2
|
+
import ComponentNode from './ComponentNode';
|
|
3
|
+
import Stack from './StackNode';
|
|
4
|
+
import ParentNode from './ParentNode';
|
|
5
|
+
import SideMenuRootNode, {
|
|
6
|
+
SideMenuLeftNode,
|
|
7
|
+
SideMenuRightNode,
|
|
8
|
+
SideMenuCenterNode,
|
|
9
|
+
} from './SideMenu';
|
|
10
|
+
|
|
11
|
+
export default class LayoutNodeFactory {
|
|
12
|
+
static create(layout: any, parentNode?: ParentNode) {
|
|
13
|
+
switch (layout.type) {
|
|
14
|
+
case 'Component':
|
|
15
|
+
return new ComponentNode(layout, parentNode);
|
|
16
|
+
case 'Stack':
|
|
17
|
+
return new Stack(layout, parentNode);
|
|
18
|
+
case 'SideMenuRoot':
|
|
19
|
+
return new SideMenuRootNode(layout, parentNode);
|
|
20
|
+
case 'SideMenuLeft':
|
|
21
|
+
return new SideMenuLeftNode(layout, parentNode);
|
|
22
|
+
case 'SideMenuCenter':
|
|
23
|
+
return new SideMenuCenterNode(layout, parentNode);
|
|
24
|
+
case 'SideMenuRight':
|
|
25
|
+
return new SideMenuRightNode(layout, parentNode);
|
|
26
|
+
default: // TODO Undo
|
|
27
|
+
case 'BottomTabs':
|
|
28
|
+
return new BottomTabs(layout, parentNode);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|