Every line of 'react native center text' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
225 renderCenter() { 226 let msg = this.props.currentMessage; 227 if(msg.msgType === 'notification'){ 228 return ( 229 <View style={{alignItems: 'center', 230 justifyContent: 'center', 231 marginTop: 5, 232 marginBottom: 10}}> 233 <View style={{backgroundColor:'#cecece',borderRadius:5,paddingHorizontal:5,paddingVertical:3 }}> 234 <Text style={{ 235 color: '#fff', 236 fontSize: 12, 237 fontWeight: '400',}}> 238 {msg.extend.tipMsg} 239 </Text> 240 </View> 241 </View> 242 ); 243 } 244 return null; 245 246 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
35 public render(): JSX.Element { 36 const { align, style, children, ...rest } = this.props; 37 38 const styleJoined = Object.assign({ textAlign: align }, style); 39 40 return ( 41 <div className={styles.root} {...rest} style={styleJoined}> 42 <span className={styles.spring} /> 43 <span className={styles.container}>{children}</span> 44 </div> 45 ); 46 }
55 export function useInitToCenter({ containerRef, width, height, setPosition }) { 56 const initToCenter = useCallback((isInitializedRef) => { 57 const { current: container } = containerRef 58 if (!container) { 59 isInitializedRef.current = false 60 return 61 } 62 const rect = container.getBoundingClientRect() 63 setPosition([ 64 ((rect.width / 2) - (width / 2)), 65 ((rect.height / 2) - (height / 2)), 66 ]) 67 }, [containerRef, width, height, setPosition]) 68 69 return useInitPosition(initToCenter) 70 }
18 render() { 19 const {children, ...props} = this.props; 20 return React.createElement('Text', props, children); 21 }
20 componentDidMount() { 21 this.onPlayingUpdate(this.props.playing); 22 }
48 componentDidUpdate() { 49 this.setDOM(); 50 }
18 constructor(props) { 19 super(props); 20 this.state = { 21 y: new Animated.Value(-1.5), 22 opacity: new Animated.Value(0), 23 }; 24 }
40 Text.render = function render(props, ...args) { 41 const oldProps = props; 42 let newProps = {...props, style: [defaultFontFamily.style, props.style]}; 43 try { 44 return Reflect.apply(TextRender, this, [newProps, ...args]); 45 } finally { 46 newProps = oldProps; 47 } 48 };
45 ansiAlign.center = function center (text) { 46 return ansiAlign(text, { align: 'center' }) 47 }
32 constructor(props) { 33 super(props); 34 35 this.state = { 36 show: false, 37 }; 38 }