// your-code.jsimport { ifVal } from './components-helpers.js'
// BE SURE to replace all true/false with a real condition in you code// this is just an example
const inputProps = {value: 'foo',enabled: ifVal(true), // truenoProp: ifVal(false), // null - ignored by ReactaProp: ifVal(true, 'my value'), // 'my value'bProp: ifVal(false, 'the true text', 'the false text') // 'my false value',onAction: ifVal(isGuest, handleGuest, handleUser) // it depends on isGuest value};
<MyComponent {...inputProps} />
import { RNCamera } from 'react-native-camera';[...]
export default class MyView extends React.Component {
_myFunction = (myObject) => {console.log(myObject.type); //}
render() {
var scannerProps = Platform.OS === 'ios' ?{onBarCodeRead : this._myFunction}:{// here you can add attribute(s) for other platforms}
return (// it is just a part of code for MyView's layout<RNCameraref={ref => { this.camera = ref; }}style=\{\{ flex: 1, justifyContent: 'flex-end', alignItems: 'center', }}type={RNCamera.Constants.Type.back}flashMode={RNCamera.Constants.FlashMode.on}{...scannerProps}/>);}}