react-native#requireNativeComponent TypeScript Examples
The following examples show how to use
react-native#requireNativeComponent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddToWalletButton.tsx From stripe-react-native with MIT License | 5 votes |
AddToWalletButtonNative =
requireNativeComponent<any>('AddToWalletButton')
Example #2
Source File: FBShareButton.tsx From react-native-fbsdk-next with MIT License | 5 votes |
RCTFBShareButton =
requireNativeComponent<PropsOf<ShareButton>>('RCTFBShareButton')
Example #3
Source File: FBSendButton.tsx From react-native-fbsdk-next with MIT License | 5 votes |
RCTFBSendButton =
requireNativeComponent<PropsOf<SendButton>>('RCTFBSendButton')
Example #4
Source File: FBLoginButton.tsx From react-native-fbsdk-next with MIT License | 5 votes |
RCTFBLoginButton =
requireNativeComponent<RCTFBLoginButtonProps>('RCTFBLoginButton')
Example #5
Source File: StripeContainer.tsx From stripe-react-native with MIT License | 5 votes |
StripeContainerNative = requireNativeComponent<any>('StripeContainer')
Example #6
Source File: GooglePayButton.tsx From stripe-react-native with MIT License | 5 votes |
GooglePayButtonNative = requireNativeComponent<any>('GooglePayButton')
Example #7
Source File: CardForm.tsx From stripe-react-native with MIT License | 5 votes |
CardFormNative =
requireNativeComponent<CardFormView.NativeProps>('CardForm')
Example #8
Source File: CardField.tsx From stripe-react-native with MIT License | 5 votes |
CardFieldNative =
requireNativeComponent<CardFieldInput.NativeProps>('CardField')
Example #9
Source File: AuBECSDebitForm.tsx From stripe-react-native with MIT License | 5 votes |
AuBECSDebitFormNative =
requireNativeComponent<AuBECSDebitFormComponent.NativeProps>(
'AuBECSDebitForm'
)
Example #10
Source File: ApplePayButton.tsx From stripe-react-native with MIT License | 5 votes |
ApplePayButtonNative =
requireNativeComponent<ApplePayButtonComponent.NativeProps>('ApplePayButton')
Example #11
Source File: RNShadow.tsx From curved-bottom-navigation-bar with MIT License | 5 votes |
RNShadow =
Platform.OS === 'android' ? requireNativeComponent('RNShadow') : View
Example #12
Source File: GiphyMediaView.tsx From react-native-giphy-ui with MIT License | 5 votes |
RNGiphyMediaView = Platform.select({
ios: requireNativeComponent('GiphyMediaView'),
android: null,
})
Example #13
Source File: SafeAreaView.native.tsx From nlw2-proffy with MIT License | 5 votes |
SafeAreaView = requireNativeComponent<NativeSafeAreaViewProps>(
'RNCSafeAreaView',
)
Example #14
Source File: NativeAppearance.tsx From nlw2-proffy with MIT License | 5 votes |
NativeAppearanceProvider =
Platform.OS === 'android'
? FallbackAppearanceProvider
: requireNativeComponent('RNCAppearanceProvider')
Example #15
Source File: NativeViewManagerAdapter.native.tsx From nlw2-proffy with MIT License | 5 votes |
/**
* A drop-in replacement for `requireNativeComponent`.
*/
export function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P> {
if (__DEV__) {
const { NativeUnimoduleProxy } = NativeModules;
if (!NativeUnimoduleProxy.viewManagersNames.includes(viewName)) {
const exportedViewManagerNames = NativeUnimoduleProxy.viewManagersNames.join(', ');
console.warn(
`The native view manager required by name (${viewName}) from NativeViewManagerAdapter isn't exported by @unimodules/react-native-adapter. Views of this type may not render correctly. Exported view managers: [${exportedViewManagerNames}].`
);
}
}
// Set up the React Native native component, which is an adapter to the universal module's view
// manager
const reactNativeViewName = `ViewManagerAdapter_${viewName}`;
const ReactNativeComponent = requireNativeComponent<NativeExpoComponentProps>(
reactNativeViewName
);
const reactNativeUIConfiguration = (UIManager.getViewManagerConfig
? UIManager.getViewManagerConfig(reactNativeViewName)
: UIManager[reactNativeViewName]) || {
NativeProps: {},
directEventTypes: {},
};
const reactNativeComponentPropNames = [
'children',
...ViewPropTypesKeys,
...Object.keys(reactNativeUIConfiguration.NativeProps),
...Object.keys(reactNativeUIConfiguration.directEventTypes),
];
// Define a component for universal-module authors to access their native view manager
function NativeComponentAdapter(props, ref) {
// TODO: `omit` may incur a meaningful performance cost across many native components rendered
// in the same update. Profile this and write out a partition function if this is a bottleneck.
const nativeProps = pick(props, reactNativeComponentPropNames);
const proxiedProps = omit(props, reactNativeComponentPropNames);
return <ReactNativeComponent {...nativeProps} proxiedProperties={proxiedProps} ref={ref} />;
}
NativeComponentAdapter.displayName = `Adapter<${viewName}>`;
return React.forwardRef(NativeComponentAdapter);
}
Example #16
Source File: RNIWrapperView.ts From react-native-ios-context-menu with MIT License | 5 votes |
NativeComponent = requireNativeComponent<RNIWrapperViewProps>(COMPONENT_NAME)
Example #17
Source File: RNIContextMenuView.ts From react-native-ios-context-menu with MIT License | 5 votes |
RNIContextMenuView: HostComponent<RNIContextMenuViewProps> = Platform.select({
ios: () => requireNativeComponent(viewName) as any,
default: () => View,
})()
Example #18
Source File: RNIContextMenuButton.ts From react-native-ios-context-menu with MIT License | 5 votes |
RNIContextMenuButton: HostComponent<RNIContextMenuViewProps> = Platform.select({
ios: () => requireNativeComponent(viewName) as any,
default: () => View,
})()
Example #19
Source File: RNShadow.tsx From curved-bottom-navigation-bar with MIT License | 5 votes |
RNShadow =
Platform.OS === 'android' ? requireNativeComponent('RNShadow') : View