@callstack/react-native-brownfield 0.1.0 → 1.0.0-rc.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 +24 -1
- package/ReactBrownfield.podspec +22 -0
- package/android/build.gradle +103 -15
- package/android/gradle.properties +5 -0
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt +82 -15
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfieldPackage.kt +9 -9
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeFragment.kt +139 -145
- package/android/src/newarch/ReactNativeBrownfieldModule.kt +37 -0
- package/android/src/oldarch/ReactNativeBrownfieldModule.kt +38 -0
- package/ios/ReactNativeBrownfield.swift +119 -0
- package/ios/ReactNativeBrownfieldModule.h +7 -2
- package/ios/ReactNativeBrownfieldModule.mm +25 -0
- package/ios/ReactNativeBrownfieldModule.swift +18 -0
- package/ios/ReactNativeView.swift +43 -0
- package/ios/ReactNativeViewController.swift +66 -0
- package/lib/commonjs/NativeReactNativeBrownfieldModule.js +2 -0
- package/lib/commonjs/NativeReactNativeBrownfieldModule.js.map +1 -0
- package/lib/commonjs/index.js +1 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeReactNativeBrownfieldModule.js +2 -0
- package/lib/module/NativeReactNativeBrownfieldModule.js.map +1 -0
- package/lib/module/index.js +1 -22
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeReactNativeBrownfieldModule.d.ts +20 -0
- package/lib/typescript/commonjs/src/NativeReactNativeBrownfieldModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeReactNativeBrownfieldModule.d.ts +20 -0
- package/lib/typescript/module/src/NativeReactNativeBrownfieldModule.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +6 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +62 -31
- package/src/NativeReactNativeBrownfieldModule.ts +23 -0
- package/src/index.ts +6 -7
- package/ReactNativeBrownfield.podspec +0 -20
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeActivity.kt +0 -188
- package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfieldModule.kt +0 -32
- package/ios/ReactNativeBrownfield.h +0 -24
- package/ios/ReactNativeBrownfield.m +0 -82
- package/ios/ReactNativeBrownfieldModule.m +0 -24
- package/ios/ReactNativeBrownfieldNotifications.h +0 -4
- package/ios/ReactNativeBrownfieldNotifications.m +0 -4
- package/ios/ReactNativeViewController.h +0 -15
- package/ios/ReactNativeViewController.m +0 -66
- package/lib/typescript/src/index.d.ts.map +0 -1
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeBrownfieldModule.ts"],"mappings":"gFACA,IAAAA,YAAA,CAAAC,OAAA,iBAAmD,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAqBpCC,gCAAmB,CAACC,YAAY,CAAO,uBAAuB,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
const ReactNativeBrownfield = {
|
|
9
|
-
popToNative: animated => {
|
|
10
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
11
|
-
_reactNative.NativeModules.ReactNativeBrownfield.popToNative(animated);
|
|
12
|
-
} else if (_reactNative.Platform.OS === 'android') {
|
|
13
|
-
_reactNative.NativeModules.ReactNativeBrownfield.popToNative();
|
|
14
|
-
} else {
|
|
15
|
-
console.warn('Not implemented: popToNative');
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
setNativeBackGestureAndButtonEnabled: enabled => {
|
|
19
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
20
|
-
_reactNative.NativeModules.ReactNativeBrownfield.setPopGestureRecognizerEnabled(enabled);
|
|
21
|
-
} else if (_reactNative.Platform.OS === 'android') {
|
|
22
|
-
_reactNative.NativeModules.ReactNativeBrownfield.setHardwareBackButtonEnabled(enabled);
|
|
23
|
-
} else {
|
|
24
|
-
console.warn('Not implemented: setNativeGesturesAndButtonsEnabled');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var _default = exports.default = ReactNativeBrownfield;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var _NativeReactNativeBrownfieldModule=_interopRequireDefault(require("./NativeReactNativeBrownfieldModule"));var ReactNativeBrownfield={popToNative:function popToNative(animated){if(_reactNative.Platform.OS==='ios'){_NativeReactNativeBrownfieldModule.default.popToNative(!!animated);}else if(_reactNative.Platform.OS==='android'){_NativeReactNativeBrownfieldModule.default.popToNative(false);}else{console.warn('Not implemented: popToNative');}},setNativeBackGestureAndButtonEnabled:function setNativeBackGestureAndButtonEnabled(enabled){if(_reactNative.Platform.OS==='ios'){_NativeReactNativeBrownfieldModule.default.setPopGestureRecognizerEnabled(enabled);}else if(_reactNative.Platform.OS==='android'){_NativeReactNativeBrownfieldModule.default.setHardwareBackButtonEnabled(enabled);}else{console.warn('Not implemented: setNativeGesturesAndButtonsEnabled');}}};var _default=exports.default=ReactNativeBrownfield;
|
|
29
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","ReactNativeBrownfield","popToNative","animated","Platform","OS","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeReactNativeBrownfieldModule","_interopRequireDefault","ReactNativeBrownfield","popToNative","animated","Platform","OS","ReactNativeBrownfieldModule","console","warn","setNativeBackGestureAndButtonEnabled","enabled","setPopGestureRecognizerEnabled","setHardwareBackButtonEnabled","_default","exports","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"mKAAA,IAAAA,YAAA,CAAAC,OAAA,iBACA,IAAAC,kCAAA,CAAAC,sBAAA,CAAAF,OAAA,yCAEA,GAAM,CAAAG,qBAAqB,CAAG,CAC5BC,WAAW,CAAE,QAAb,CAAAA,WAAWA,CAAGC,QAAkB,CAAW,CACzC,GAAIC,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzBC,0CAA2B,CAACJ,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,CACrD,CAAC,IAAM,IAAIC,qBAAQ,CAACC,EAAE,GAAK,SAAS,CAAE,CACpCC,0CAA2B,CAACJ,WAAW,CAAC,KAAK,CAAC,CAChD,CAAC,IAAM,CACLK,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC,CAC9C,CACF,CAAC,CAEDC,oCAAoC,CAAE,QAAtC,CAAAA,oCAAoCA,CAAGC,OAAgB,CAAW,CAChE,GAAIN,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzBC,0CAA2B,CAACK,8BAA8B,CAACD,OAAO,CAAC,CACrE,CAAC,IAAM,IAAIN,qBAAQ,CAACC,EAAE,GAAK,SAAS,CAAE,CACpCC,0CAA2B,CAACM,4BAA4B,CAACF,OAAO,CAAC,CACnE,CAAC,IAAM,CACLH,OAAO,CAACC,IAAI,CAAC,qDAAqD,CAAC,CACrE,CACF,CACF,CAAC,CAAC,IAAAK,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEad,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var _default=exports.default=_reactNative.TurboModuleRegistry.getEnforcing('ReactNativeBrownfield');
|
|
2
|
+
//# sourceMappingURL=NativeReactNativeBrownfieldModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeBrownfieldModule.ts"],"mappings":"gFACA,IAAAA,YAAA,CAAAC,OAAA,iBAAmD,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAqBpCC,gCAAmB,CAACC,YAAY,CAAO,uBAAuB,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const ReactNativeBrownfield = {
|
|
3
|
-
popToNative: animated => {
|
|
4
|
-
if (Platform.OS === 'ios') {
|
|
5
|
-
NativeModules.ReactNativeBrownfield.popToNative(animated);
|
|
6
|
-
} else if (Platform.OS === 'android') {
|
|
7
|
-
NativeModules.ReactNativeBrownfield.popToNative();
|
|
8
|
-
} else {
|
|
9
|
-
console.warn('Not implemented: popToNative');
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
setNativeBackGestureAndButtonEnabled: enabled => {
|
|
13
|
-
if (Platform.OS === 'ios') {
|
|
14
|
-
NativeModules.ReactNativeBrownfield.setPopGestureRecognizerEnabled(enabled);
|
|
15
|
-
} else if (Platform.OS === 'android') {
|
|
16
|
-
NativeModules.ReactNativeBrownfield.setHardwareBackButtonEnabled(enabled);
|
|
17
|
-
} else {
|
|
18
|
-
console.warn('Not implemented: setNativeGesturesAndButtonsEnabled');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export default ReactNativeBrownfield;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var _NativeReactNativeBrownfieldModule=_interopRequireDefault(require("./NativeReactNativeBrownfieldModule"));var ReactNativeBrownfield={popToNative:function popToNative(animated){if(_reactNative.Platform.OS==='ios'){_NativeReactNativeBrownfieldModule.default.popToNative(!!animated);}else if(_reactNative.Platform.OS==='android'){_NativeReactNativeBrownfieldModule.default.popToNative(false);}else{console.warn('Not implemented: popToNative');}},setNativeBackGestureAndButtonEnabled:function setNativeBackGestureAndButtonEnabled(enabled){if(_reactNative.Platform.OS==='ios'){_NativeReactNativeBrownfieldModule.default.setPopGestureRecognizerEnabled(enabled);}else if(_reactNative.Platform.OS==='android'){_NativeReactNativeBrownfieldModule.default.setHardwareBackButtonEnabled(enabled);}else{console.warn('Not implemented: setNativeGesturesAndButtonsEnabled');}}};var _default=exports.default=ReactNativeBrownfield;
|
|
23
2
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeReactNativeBrownfieldModule","_interopRequireDefault","ReactNativeBrownfield","popToNative","animated","Platform","OS","ReactNativeBrownfieldModule","console","warn","setNativeBackGestureAndButtonEnabled","enabled","setPopGestureRecognizerEnabled","setHardwareBackButtonEnabled","_default","exports","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"mKAAA,IAAAA,YAAA,CAAAC,OAAA,iBACA,IAAAC,kCAAA,CAAAC,sBAAA,CAAAF,OAAA,yCAEA,GAAM,CAAAG,qBAAqB,CAAG,CAC5BC,WAAW,CAAE,QAAb,CAAAA,WAAWA,CAAGC,QAAkB,CAAW,CACzC,GAAIC,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzBC,0CAA2B,CAACJ,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,CACrD,CAAC,IAAM,IAAIC,qBAAQ,CAACC,EAAE,GAAK,SAAS,CAAE,CACpCC,0CAA2B,CAACJ,WAAW,CAAC,KAAK,CAAC,CAChD,CAAC,IAAM,CACLK,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC,CAC9C,CACF,CAAC,CAEDC,oCAAoC,CAAE,QAAtC,CAAAA,oCAAoCA,CAAGC,OAAgB,CAAW,CAChE,GAAIN,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzBC,0CAA2B,CAACK,8BAA8B,CAACD,OAAO,CAAC,CACrE,CAAC,IAAM,IAAIN,qBAAQ,CAACC,EAAE,GAAK,SAAS,CAAE,CACpCC,0CAA2B,CAACM,4BAA4B,CAACF,OAAO,CAAC,CACnE,CAAC,IAAM,CACLH,OAAO,CAACC,IAAI,CAAC,qDAAqD,CAAC,CACrE,CACF,CACF,CAAC,CAAC,IAAAK,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEad,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/**
|
|
4
|
+
* Navigate back to the native part of the application.
|
|
5
|
+
*/
|
|
6
|
+
popToNative(animated: boolean): void;
|
|
7
|
+
/**
|
|
8
|
+
* Enable or disable the iOS swipe back gesture.
|
|
9
|
+
* @platform ios
|
|
10
|
+
*/
|
|
11
|
+
setPopGestureRecognizerEnabled(enabled: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* Enable or disable the Android hardware back button.
|
|
14
|
+
* @platform android
|
|
15
|
+
*/
|
|
16
|
+
setHardwareBackButtonEnabled(enabled: boolean): void;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: Spec;
|
|
19
|
+
export default _default;
|
|
20
|
+
//# sourceMappingURL=NativeReactNativeBrownfieldModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeReactNativeBrownfieldModule.d.ts","sourceRoot":"","sources":["../../../../src/NativeReactNativeBrownfieldModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACtD;;AAED,wBAA+E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qBAAqB;6BACA,OAAO,KAAG,IAAI;oDAUS,OAAO,KAAG,IAAI;CAS/D,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/**
|
|
4
|
+
* Navigate back to the native part of the application.
|
|
5
|
+
*/
|
|
6
|
+
popToNative(animated: boolean): void;
|
|
7
|
+
/**
|
|
8
|
+
* Enable or disable the iOS swipe back gesture.
|
|
9
|
+
* @platform ios
|
|
10
|
+
*/
|
|
11
|
+
setPopGestureRecognizerEnabled(enabled: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* Enable or disable the Android hardware back button.
|
|
14
|
+
* @platform android
|
|
15
|
+
*/
|
|
16
|
+
setHardwareBackButtonEnabled(enabled: boolean): void;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: Spec;
|
|
19
|
+
export default _default;
|
|
20
|
+
//# sourceMappingURL=NativeReactNativeBrownfieldModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeReactNativeBrownfieldModule.d.ts","sourceRoot":"","sources":["../../../../src/NativeReactNativeBrownfieldModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACtD;;AAED,wBAA+E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qBAAqB;6BACA,OAAO,KAAG,IAAI;oDAUS,OAAO,KAAG,IAAI;CAS/D,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/react-native-brownfield",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -10,14 +10,27 @@
|
|
|
10
10
|
"description": "Brownfield helpers for React Native",
|
|
11
11
|
"main": "lib/commonjs/index",
|
|
12
12
|
"module": "lib/module/index",
|
|
13
|
-
"types": "lib/typescript/src/index.d.ts",
|
|
13
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
14
14
|
"react-native": "src/index",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
19
|
+
"default": "./lib/module/index.js"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
23
|
+
"default": "./lib/commonjs/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
15
28
|
"scripts": {
|
|
16
|
-
"start": "react-native start --reset-cache",
|
|
17
29
|
"lint": "eslint . --fix",
|
|
18
30
|
"typecheck": "tsc --noEmit",
|
|
19
31
|
"release": "release-it",
|
|
20
|
-
"prepare": "bob build"
|
|
32
|
+
"prepare": "bob build",
|
|
33
|
+
"brownfield:plugin:publish:local": "bash ./gradle-plugins/publish-to-maven-local.sh"
|
|
21
34
|
},
|
|
22
35
|
"keywords": [
|
|
23
36
|
"react-native-brownfield",
|
|
@@ -47,41 +60,35 @@
|
|
|
47
60
|
"access": "public"
|
|
48
61
|
},
|
|
49
62
|
"resolutions": {
|
|
50
|
-
"@types/react": "
|
|
63
|
+
"@types/react": "19.0.0"
|
|
51
64
|
},
|
|
52
65
|
"peerDependencies": {
|
|
53
66
|
"react": "*",
|
|
54
67
|
"react-native": "*"
|
|
55
68
|
},
|
|
56
69
|
"devDependencies": {
|
|
57
|
-
"@babel/core": "^7.
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
59
|
-
"@babel/runtime": "^7.
|
|
60
|
-
"@react-native/babel-preset": "0.
|
|
61
|
-
"@react-native/eslint-config": "0.
|
|
62
|
-
"@react-native/
|
|
63
|
-
"@react-native/typescript-config": "0.74.84",
|
|
64
|
-
"@react-navigation/native": "^6.1.17",
|
|
65
|
-
"@react-navigation/native-stack": "^6.9.17",
|
|
70
|
+
"@babel/core": "^7.25.2",
|
|
71
|
+
"@babel/preset-env": "^7.25.3",
|
|
72
|
+
"@babel/runtime": "^7.25.0",
|
|
73
|
+
"@react-native/babel-preset": "0.78.0",
|
|
74
|
+
"@react-native/eslint-config": "0.78.0",
|
|
75
|
+
"@react-native/typescript-config": "0.78.0",
|
|
66
76
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/react
|
|
69
|
-
"
|
|
77
|
+
"@types/jest": "^29.5.13",
|
|
78
|
+
"@types/react": "^19.0.0",
|
|
79
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
70
80
|
"babel-plugin-module-resolver": "5.0.0",
|
|
71
81
|
"eslint": "^8.19.0",
|
|
82
|
+
"eslint-config-prettier": "^9.1.0",
|
|
72
83
|
"eslint-plugin-prettier": "^5.1.3",
|
|
73
84
|
"jest": "^29.6.3",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"react": "
|
|
77
|
-
"react-native": "0.
|
|
78
|
-
"react-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"react-native-screens": "^3.31.1",
|
|
82
|
-
"react-test-renderer": "18.2.0",
|
|
83
|
-
"release-it": "^15.0.0",
|
|
84
|
-
"typescript": "^5.0.4"
|
|
85
|
+
"prettier": "^3.5.3",
|
|
86
|
+
"react": "19.0.0",
|
|
87
|
+
"react-native": "0.78.0",
|
|
88
|
+
"react-native-builder-bob": "^0.37.0",
|
|
89
|
+
"react-test-renderer": "19.0.0",
|
|
90
|
+
"release-it": "^18.1.2",
|
|
91
|
+
"typescript": "5.0.4"
|
|
85
92
|
},
|
|
86
93
|
"release-it": {
|
|
87
94
|
"git": {
|
|
@@ -106,6 +113,9 @@
|
|
|
106
113
|
"@react-native",
|
|
107
114
|
"prettier"
|
|
108
115
|
],
|
|
116
|
+
"plugins": [
|
|
117
|
+
"prettier"
|
|
118
|
+
],
|
|
109
119
|
"rules": {
|
|
110
120
|
"prettier/prettier": [
|
|
111
121
|
"error",
|
|
@@ -119,6 +129,14 @@
|
|
|
119
129
|
]
|
|
120
130
|
}
|
|
121
131
|
},
|
|
132
|
+
"codegenConfig": {
|
|
133
|
+
"name": "ReactNativeBrownfield",
|
|
134
|
+
"type": "modules",
|
|
135
|
+
"jsSrcsDir": "./src",
|
|
136
|
+
"android": {
|
|
137
|
+
"javaPackageName": "com.callstack.reactnativebrownfield"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
122
140
|
"prettier": {
|
|
123
141
|
"quoteProps": "consistent",
|
|
124
142
|
"singleQuote": true,
|
|
@@ -130,12 +148,25 @@
|
|
|
130
148
|
"source": "src",
|
|
131
149
|
"output": "lib",
|
|
132
150
|
"targets": [
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
[
|
|
152
|
+
"commonjs",
|
|
153
|
+
{
|
|
154
|
+
"esm": true,
|
|
155
|
+
"configFile": true
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
[
|
|
159
|
+
"module",
|
|
160
|
+
{
|
|
161
|
+
"esm": true,
|
|
162
|
+
"configFile": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
135
165
|
[
|
|
136
166
|
"typescript",
|
|
137
167
|
{
|
|
138
|
-
"project": "tsconfig.build.json"
|
|
168
|
+
"project": "tsconfig.build.json",
|
|
169
|
+
"esm": true
|
|
139
170
|
}
|
|
140
171
|
]
|
|
141
172
|
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
/**
|
|
6
|
+
* Navigate back to the native part of the application.
|
|
7
|
+
*/
|
|
8
|
+
popToNative(animated: boolean): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Enable or disable the iOS swipe back gesture.
|
|
12
|
+
* @platform ios
|
|
13
|
+
*/
|
|
14
|
+
setPopGestureRecognizerEnabled(enabled: boolean): void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enable or disable the Android hardware back button.
|
|
18
|
+
* @platform android
|
|
19
|
+
*/
|
|
20
|
+
setHardwareBackButtonEnabled(enabled: boolean): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('ReactNativeBrownfield');
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import ReactNativeBrownfieldModule from './NativeReactNativeBrownfieldModule';
|
|
2
3
|
|
|
3
4
|
const ReactNativeBrownfield = {
|
|
4
5
|
popToNative: (animated?: boolean): void => {
|
|
5
6
|
if (Platform.OS === 'ios') {
|
|
6
|
-
|
|
7
|
+
ReactNativeBrownfieldModule.popToNative(!!animated);
|
|
7
8
|
} else if (Platform.OS === 'android') {
|
|
8
|
-
|
|
9
|
+
ReactNativeBrownfieldModule.popToNative(false);
|
|
9
10
|
} else {
|
|
10
11
|
console.warn('Not implemented: popToNative');
|
|
11
12
|
}
|
|
@@ -13,11 +14,9 @@ const ReactNativeBrownfield = {
|
|
|
13
14
|
|
|
14
15
|
setNativeBackGestureAndButtonEnabled: (enabled: boolean): void => {
|
|
15
16
|
if (Platform.OS === 'ios') {
|
|
16
|
-
|
|
17
|
-
enabled,
|
|
18
|
-
);
|
|
17
|
+
ReactNativeBrownfieldModule.setPopGestureRecognizerEnabled(enabled);
|
|
19
18
|
} else if (Platform.OS === 'android') {
|
|
20
|
-
|
|
19
|
+
ReactNativeBrownfieldModule.setHardwareBackButtonEnabled(enabled);
|
|
21
20
|
} else {
|
|
22
21
|
console.warn('Not implemented: setNativeGesturesAndButtonsEnabled');
|
|
23
22
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |spec|
|
|
6
|
-
spec.name = "ReactNativeBrownfield"
|
|
7
|
-
spec.version = package['version']
|
|
8
|
-
spec.summary = package['description']
|
|
9
|
-
spec.license = package['license']
|
|
10
|
-
|
|
11
|
-
spec.authors = package['author']
|
|
12
|
-
spec.homepage = package['homepage']
|
|
13
|
-
spec.platform = :ios, "9.0"
|
|
14
|
-
|
|
15
|
-
# s.source = { :git => "git@github.com/michalchudziak/react-native-brownfield.git", :tag => "v#{s.version}" }
|
|
16
|
-
spec.source = { :path => "." }
|
|
17
|
-
spec.source_files = "ios/**/*.{h,m}"
|
|
18
|
-
|
|
19
|
-
spec.dependency 'React'
|
|
20
|
-
end
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
package com.callstack.reactnativebrownfield
|
|
2
|
-
|
|
3
|
-
import android.annotation.TargetApi
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import android.content.Intent
|
|
6
|
-
import android.os.Build
|
|
7
|
-
import android.os.Bundle
|
|
8
|
-
import android.view.KeyEvent
|
|
9
|
-
import com.facebook.infer.annotation.Assertions
|
|
10
|
-
import com.facebook.react.ReactActivity
|
|
11
|
-
import com.facebook.react.ReactRootView
|
|
12
|
-
import com.facebook.react.devsupport.DoubleTapReloadRecognizer
|
|
13
|
-
import com.facebook.react.modules.core.PermissionListener
|
|
14
|
-
import com.facebook.react.bridge.Callback
|
|
15
|
-
import com.facebook.react.bridge.ReadableMap
|
|
16
|
-
import com.facebook.react.common.DebugServerException
|
|
17
|
-
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
|
18
|
-
import com.facebook.react.modules.core.PermissionAwareActivity
|
|
19
|
-
|
|
20
|
-
private const val MODULE_NAME = "com.callstack.reactnativebrownfield.ACTIVITY_MODULE_NAME"
|
|
21
|
-
private const val INITIAL_PROPS = "com.callstack.reactnativebrownfield.ACTIVITY_INITIAL_PROPS"
|
|
22
|
-
|
|
23
|
-
class ReactNativeActivity : ReactActivity(), DefaultHardwareBackBtnHandler, PermissionAwareActivity {
|
|
24
|
-
private var reactRootView: ReactRootView? = null
|
|
25
|
-
private lateinit var doubleTapReloadRecognizer: DoubleTapReloadRecognizer
|
|
26
|
-
private lateinit var permissionsCallback: Callback
|
|
27
|
-
private var permissionListener: PermissionListener? = null
|
|
28
|
-
|
|
29
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
30
|
-
super.onCreate(savedInstanceState)
|
|
31
|
-
|
|
32
|
-
val moduleName = intent.getStringExtra(MODULE_NAME)
|
|
33
|
-
val initialProps = intent.getBundleExtra(INITIAL_PROPS)
|
|
34
|
-
|
|
35
|
-
reactRootView = ReactRootView(this)
|
|
36
|
-
reactRootView?.startReactApplication(
|
|
37
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager,
|
|
38
|
-
moduleName,
|
|
39
|
-
initialProps
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
supportActionBar?.hide()
|
|
43
|
-
setContentView(reactRootView)
|
|
44
|
-
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
45
|
-
checkPackagerConnection()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override fun onDestroy() {
|
|
49
|
-
super.onDestroy()
|
|
50
|
-
reactRootView?.unmountReactApplication()
|
|
51
|
-
reactRootView = null
|
|
52
|
-
|
|
53
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()) {
|
|
54
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager?.onHostDestroy(this)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
59
|
-
super.onActivityResult(requestCode, resultCode, data)
|
|
60
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()) {
|
|
61
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager?.onActivityResult(this, requestCode, resultCode, data)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
|
66
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()
|
|
67
|
-
&& ReactNativeBrownfield.shared.reactNativeHost.useDeveloperSupport
|
|
68
|
-
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
|
|
69
|
-
) {
|
|
70
|
-
event.startTracking()
|
|
71
|
-
return true
|
|
72
|
-
}
|
|
73
|
-
return false
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
|
|
77
|
-
if(keyCode == KeyEvent.KEYCODE_BACK) {
|
|
78
|
-
onBackPressed()
|
|
79
|
-
return true
|
|
80
|
-
}
|
|
81
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()
|
|
82
|
-
&& ReactNativeBrownfield.shared.reactNativeHost.useDeveloperSupport) {
|
|
83
|
-
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
|
84
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager.showDevOptionsDialog()
|
|
85
|
-
return true
|
|
86
|
-
}
|
|
87
|
-
val didDoubleTapR = this.currentFocus?.let {
|
|
88
|
-
Assertions.assertNotNull(doubleTapReloadRecognizer)
|
|
89
|
-
.didDoubleTapR(keyCode, it)
|
|
90
|
-
}
|
|
91
|
-
if (didDoubleTapR == true) {
|
|
92
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager.devSupportManager.handleReloadJS()
|
|
93
|
-
return true
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
override fun onKeyLongPress(keyCode: Int, event: KeyEvent): Boolean {
|
|
100
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()
|
|
101
|
-
&& ReactNativeBrownfield.shared.reactNativeHost.useDeveloperSupport
|
|
102
|
-
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
|
|
103
|
-
) {
|
|
104
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager.showDevOptionsDialog()
|
|
105
|
-
return true
|
|
106
|
-
}
|
|
107
|
-
return false
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
override fun onBackPressed() {
|
|
111
|
-
if(ReactNativeBrownfieldModule.shouldPopToNative) {
|
|
112
|
-
super.invokeDefaultOnBackPressed()
|
|
113
|
-
} else if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance()) {
|
|
114
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager.onBackPressed()
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
override fun invokeDefaultOnBackPressed() {
|
|
119
|
-
super.onBackPressed()
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@TargetApi(Build.VERSION_CODES.M)
|
|
123
|
-
override fun requestPermissions(
|
|
124
|
-
permissions: Array<String>,
|
|
125
|
-
requestCode: Int,
|
|
126
|
-
listener: PermissionListener
|
|
127
|
-
) {
|
|
128
|
-
permissionListener = listener
|
|
129
|
-
this.requestPermissions(permissions, requestCode)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
override fun onRequestPermissionsResult(
|
|
133
|
-
requestCode: Int,
|
|
134
|
-
permissions: Array<String>,
|
|
135
|
-
grantResults: IntArray
|
|
136
|
-
) {
|
|
137
|
-
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
138
|
-
permissionsCallback = Callback {
|
|
139
|
-
if (permissionListener != null) {
|
|
140
|
-
permissionListener?.onRequestPermissionsResult(
|
|
141
|
-
requestCode,
|
|
142
|
-
permissions,
|
|
143
|
-
grantResults
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
permissionListener = null
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
private fun checkPackagerConnection() {
|
|
152
|
-
if (ReactNativeBrownfield.shared.reactNativeHost.hasInstance() && ReactNativeBrownfield.shared.reactNativeHost.useDeveloperSupport) {
|
|
153
|
-
val devSupportManager =
|
|
154
|
-
ReactNativeBrownfield.shared.reactNativeHost.reactInstanceManager.devSupportManager
|
|
155
|
-
val url = devSupportManager.sourceUrl
|
|
156
|
-
devSupportManager?.isPackagerRunning { isRunning ->
|
|
157
|
-
if (!isRunning) {
|
|
158
|
-
val error = Error()
|
|
159
|
-
val message = DebugServerException.makeGeneric(url, "Could not connect to development server.", "URL: $url", error).message
|
|
160
|
-
devSupportManager.showNewJavaError(message, error)
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
companion object {
|
|
167
|
-
@JvmStatic
|
|
168
|
-
@JvmOverloads
|
|
169
|
-
fun createReactActivityIntent(context: Context, moduleName: String, initialProps: Bundle? = null): Intent {
|
|
170
|
-
val intent = Intent(context, ReactNativeActivity::class.java)
|
|
171
|
-
intent.putExtra(MODULE_NAME, moduleName)
|
|
172
|
-
if (initialProps != null) {
|
|
173
|
-
intent.putExtra(INITIAL_PROPS, initialProps)
|
|
174
|
-
}
|
|
175
|
-
return intent
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
@JvmStatic
|
|
179
|
-
fun createReactActivityIntent(context: Context, moduleName: String, initialProps: HashMap<String, *>): Intent {
|
|
180
|
-
return createReactActivityIntent(context, moduleName, PropsBundle.fromHashMap(initialProps))
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
@JvmStatic
|
|
184
|
-
fun createReactActivityIntent(context: Context, moduleName: String, initialProps: ReadableMap): Intent {
|
|
185
|
-
return createReactActivityIntent(context, moduleName, initialProps.toHashMap())
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
package/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfieldModule.kt
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package com.callstack.reactnativebrownfield
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
-
import com.facebook.react.bridge.ReactMethod
|
|
6
|
-
|
|
7
|
-
class ReactNativeBrownfieldModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
8
|
-
companion object {
|
|
9
|
-
var shouldPopToNative: Boolean = false
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@ReactMethod
|
|
13
|
-
fun popToNative() {
|
|
14
|
-
shouldPopToNative = true
|
|
15
|
-
onBackPressed()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@ReactMethod
|
|
19
|
-
fun setHardwareBackButtonEnabled(isFirstRoute: Boolean) {
|
|
20
|
-
shouldPopToNative = isFirstRoute
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private fun onBackPressed() {
|
|
24
|
-
reactApplicationContext.currentActivity?.runOnUiThread {
|
|
25
|
-
reactApplicationContext.currentActivity?.onBackPressed()
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override fun getName(): String {
|
|
30
|
-
return "ReactNativeBrownfield"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <React/RCTBridge.h>
|
|
3
|
-
#import <React/RCTBridgeDelegate.h>
|
|
4
|
-
|
|
5
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
-
|
|
7
|
-
@interface ReactNativeBrownfield : NSObject<RCTBridgeDelegate> {
|
|
8
|
-
void (^_onBundleLoaded)(void);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@property (nonatomic, copy) NSString *entryFile;
|
|
12
|
-
@property (nonatomic, copy, nullable) NSString *fallbackResource;
|
|
13
|
-
@property (nonatomic, copy) NSString *bundlePath;
|
|
14
|
-
@property (nonatomic) RCTBridge *bridge;
|
|
15
|
-
|
|
16
|
-
+(ReactNativeBrownfield*)shared;
|
|
17
|
-
|
|
18
|
-
-(void)startReactNative;
|
|
19
|
-
-(void)startReactNative:(void(^)(void))onBundleLoaded;
|
|
20
|
-
-(void)startReactNative:(void(^)(void))onBundleLoaded launchOptions:(NSDictionary *)launchOptions;
|
|
21
|
-
|
|
22
|
-
@end
|
|
23
|
-
|
|
24
|
-
NS_ASSUME_NONNULL_END
|