@rownd/react-native 2.1.0 → 2.2.1
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/README.md +20 -1
- package/ios/RowndPlugin.swift +1 -1
- package/lib/commonjs/components/GlobalContext.js +3 -1
- package/lib/commonjs/components/GlobalContext.js.map +1 -1
- package/lib/module/components/GlobalContext.js +3 -2
- package/lib/module/components/GlobalContext.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GlobalContext.tsx +5 -2
- package/ios/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
package/README.md
CHANGED
|
@@ -24,6 +24,25 @@ cd android
|
|
|
24
24
|
|
|
25
25
|
### iOS
|
|
26
26
|
|
|
27
|
+
Add the code below to ios/Podfile. Place inside target
|
|
28
|
+
```
|
|
29
|
+
dynamic_frameworks = ['Sodium']
|
|
30
|
+
pre_install do |installer|
|
|
31
|
+
installer.pod_targets.each do |pod|
|
|
32
|
+
if dynamic_frameworks.include?(pod.name)
|
|
33
|
+
puts "Overriding the dynamic_framework? method for #{pod.name}"
|
|
34
|
+
def pod.dynamic_framework?;
|
|
35
|
+
true
|
|
36
|
+
end
|
|
37
|
+
def pod.build_type;
|
|
38
|
+
Pod::BuildType.dynamic_framework
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
On command line run:
|
|
45
|
+
|
|
27
46
|
```sh
|
|
28
47
|
cd ios
|
|
29
48
|
```
|
|
@@ -50,7 +69,7 @@ import { RowndProvider } from "@rownd/react-native";
|
|
|
50
69
|
|
|
51
70
|
export default function Root() {
|
|
52
71
|
return (
|
|
53
|
-
<RowndProvider appKey
|
|
72
|
+
<RowndProvider config={{appKey:"<your app key>"}}>
|
|
54
73
|
<App />
|
|
55
74
|
</RowndProvider>
|
|
56
75
|
);
|
package/ios/RowndPlugin.swift
CHANGED
|
@@ -20,7 +20,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
20
|
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
22
|
|
|
23
|
-
_reactNative.
|
|
23
|
+
_reactNative.YellowBox.ignoreWarnings(['Sending `update_state` with no listeners registered.']);
|
|
24
|
+
|
|
25
|
+
_reactNative.YellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);
|
|
24
26
|
|
|
25
27
|
const GlobalContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
26
28
|
exports.GlobalContext = GlobalContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["YellowBox","ignoreWarnings","GlobalContext","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","children","config","state","dispatch","useReducer","rowndReducer","initialRowndState","value","useEffect","NativeRowndModules","configure","appKey","onSessionConnect","event","type","ActionType","UPDATE_STATE","payload","Platform","OS","JSON","parse","subscription","addListener","remove","useRowndContext","context","useContext","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":";;;;;;;;AAAA;;AAOA;;AACA;;AAEA;;AAIA;;;;;;AAEAA,sBAAA,CAAUC,cAAV,CAAyB,CACvB,sDADuB,CAAzB;;AAGAD,sBAAA,CAAUC,cAAV,CAAyB,CAAC,0CAAD,CAAzB;;AAEO,MAAMC,aAAa,gBAAG,IAAAC,oBAAA,EAE3BC,SAF2B,CAAtB;;AAIP,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuBC,uCAAA,IAAwBC,wB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ext, useEffect, useContext } from 'react';
|
|
2
|
-
import { NativeEventEmitter,
|
|
2
|
+
import { NativeEventEmitter, YellowBox, Platform } from 'react-native';
|
|
3
3
|
import { initialRowndState, rowndReducer } from '../reducer/rowndReducer';
|
|
4
4
|
import * as NativeRowndModules from '../utils/nativeModule';
|
|
5
5
|
import { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';
|
|
6
6
|
import { ActionType } from '../constants/action';
|
|
7
|
-
|
|
7
|
+
YellowBox.ignoreWarnings(['Sending `update_state` with no listeners registered.']);
|
|
8
|
+
YellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);
|
|
8
9
|
export const GlobalContext = /*#__PURE__*/createContext(undefined);
|
|
9
10
|
const eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);
|
|
10
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","
|
|
1
|
+
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","YellowBox","Platform","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreWarnings","GlobalContext","undefined","eventEmitter","RowndProvider","children","config","state","dispatch","value","configure","appKey","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":"AAAA,OAAOA,KAAP,IACEC,UADF,EAEEC,aAFF,EAIEC,SAJF,EAKEC,UALF,QAMO,OANP;AAOA,SAASC,kBAAT,EAA6BC,SAA7B,EAAwCC,QAAxC,QAAwD,cAAxD;AACA,SAASC,iBAAT,EAA4BC,YAA5B,QAAgD,yBAAhD;AAEA,OAAO,KAAKC,kBAAZ,MAAoC,uBAApC;AACA,SAASC,KAAT,EAAgBC,oBAAhB,QAA4C,uBAA5C;AAGA,SAASC,UAAT,QAA2B,qBAA3B;AAEAP,SAAS,CAACQ,cAAV,CAAyB,CACvB,sDADuB,CAAzB;AAGAR,SAAS,CAACQ,cAAV,CAAyB,CAAC,0CAAD,CAAzB;AAEA,OAAO,MAAMC,aAAa,gBAAGb,aAAa,CAExCc,SAFwC,CAAnC;AAIP,MAAMC,YA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EAAwBmB,eAAxB"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useContext,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import { NativeEventEmitter,
|
|
8
|
+
import { NativeEventEmitter, YellowBox, Platform } from 'react-native';
|
|
9
9
|
import { initialRowndState, rowndReducer } from '../reducer/rowndReducer';
|
|
10
10
|
|
|
11
11
|
import * as NativeRowndModules from '../utils/nativeModule';
|
|
@@ -14,7 +14,10 @@ import type { ContextProps, GlobalState } from './GlobalContext.types';
|
|
|
14
14
|
import type { TAction } from '../constants/action';
|
|
15
15
|
import { ActionType } from '../constants/action';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
YellowBox.ignoreWarnings([
|
|
18
|
+
'Sending `update_state` with no listeners registered.',
|
|
19
|
+
]);
|
|
20
|
+
YellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);
|
|
18
21
|
|
|
19
22
|
export const GlobalContext = createContext<
|
|
20
23
|
{ state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined
|