Add Metro configuration to resolve native-only React Native APIs with web-compatible shims. This enables packages like react-native-pager-view to work on the web platform by providing shim implementations for codegenNativeComponent, codegenNativeCommands, and CodegenTypes that are unavailable in react-native-web. Also simplify Android signing configuration in CI by using standard Gradle property names (MYAPP_UPLOAD_*) and remove the build.gradle patching step.
18 lines
547 B
JavaScript
18 lines
547 B
JavaScript
const React = require('react');
|
|
|
|
function codegenNativeComponent(componentName, options) {
|
|
const componentNameClean = componentName
|
|
.replace(/^RNC/, '')
|
|
.replace(/^RNS/, '')
|
|
.replace(/^RN/, '');
|
|
|
|
const NativeComponent = React.forwardRef((props, ref) => {
|
|
const { children, ...rest } = props;
|
|
return React.createElement('div', { ...rest, ref, 'data-native-component': componentNameClean }, children);
|
|
});
|
|
NativeComponent.displayName = componentName;
|
|
|
|
return NativeComponent;
|
|
}
|
|
|
|
module.exports = codegenNativeComponent; |