Can I make dynamic styles in React Native?

后端 未结 15 2291
别跟我提以往
别跟我提以往 2020-12-12 15:24

Say I have a component with a render like this:


Where jewelStyle =

  {
    bo         


        
15条回答
  •  半阙折子戏
    2020-12-12 15:52

    Here is what worked for me:

    render() {
      const { styleValue } = this.props;
      const dynamicStyleUpdatedFromProps = {
        height: styleValue,
        width: styleValue,
        borderRadius: styleValue,
      }
    
      return (
        
      );
    }
    

    For some reason, this was the only way that mine would update properly.

提交回复
热议问题