-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathexample.js
63 lines (50 loc) · 1.61 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {Observable} from "rxjs";
import React from "react";
import {Text, TextInput, View} from "react-native";
export const applyCustomCode = externalCodeSetup => {
// call custom code api here
externalCodeSetup.indexJsApi.addIndexJsFunction(() => {
console.log("function from external set upo");
});
const reducerName = "external reducer";
externalCodeSetup.reduxApi.addReducer(
reducerName,
(s = {type: "demo"}, a) => s
);
externalCodeSetup.reduxApi.addEpic("external epic", actions =>
Observable.empty()
);
externalCodeSetup.reduxApi.wrapEpic(
"loadHomeScreen",
epic => (actions, store, dep) => epic(actions, store, dep)
);
externalCodeSetup.reduxApi.wrapReducer(
"homeScreen",
reducer => (state = reducer(undefined, {type: "demo"}), a) =>
reducer(state, a)
);
externalCodeSetup.reduxApi.addPersistorConfigChanger(config => ({
...config,
whitelist: [...config.whitelist, reducerName]
}));
externalCodeSetup.navigationApi.addNavigatorCreatedCallback(navigator => {
//debugger;
let dispatch = navigator.dispatch;
console.log("navigator created");
});
externalCodeSetup.navigationApi.replaceScreenComponent("SignupScreen", () => (
<View style={{flex: 1, alignItems: "center", justifyContent: "center"}}>
<Text>Hello from custom Login Screen</Text>
<TextInput placeholder={"login"} />
<TextInput placeholder={"password"} />
</View>
));
// externalCodeSetup.navigationApi.addNavigationRoute(
// "SignupScreen",
// () => <Text>I am custom SignupScreen</Text>,
// "Auth"
// );
externalCodeSetup.cssApi.addGlobalStyle("container", {
backgroundColor: "white"
});
};