glamorous-native
glamorous-native copied to clipboard
Dynamically determine which react-native elements are supported
Currently we manually test newer React Native components to ensure they're supported by the dependent's version of React Native.
Instead, the library could be more flexible by dynamically asserting if the component exists.
Something like
import {
View,
FlatList,
... // etc
} from 'react-native'
const components = {View, FlatList, ...}
const supportedComponents = Object.keys(components).reduce((acc, componentName) => {
if (components[componentName]) {
components[componentName] = component
}
return components
}, {})