【问题标题】:React JS: Need Gradient Color in HeaderReact JS:标题中需要渐变颜色
【发布时间】:2021-03-23 18:09:38
【问题描述】:

我在这里有一个简单的项目:https://github.com/bsumanji/firstmobileproject/blob/master/App.js 并且需要在标题背景中使用渐变颜色。请帮忙:)

从'expo-linear-gradient'导入{LinearGradient};

const Stack = createStackNavigator();

常量标准颜色 = { headerStyle:{背景颜色:“蓝色”}

};

导出默认函数 App() {

返回(

<NavigationContainer>{/* Rest of your app code */}      
   <Stack.Navigator screenOptions ={standardColor}>
      <Stack.Screen name ="Welcome" component={welcomeScreen} />
      <Stack.Screen name ="Home" component={homeScreen} />
   </Stack.Navigator>
   
</NavigationContainer>

); }

【问题讨论】:

    标签: javascript css reactjs react-native linear-gradients


    【解决方案1】:

    您可以使用 CSS linear-gradient() 函数来实现相同的功能,而不是使用库。

    例子:

    .className{
    background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
    }
    

    参考here

    【讨论】:

    • 这个功能没有帮助:(
    • 你做了什么?能发个sn-p吗?
    猜你喜欢
    • 2017-12-09
    • 2020-06-20
    • 2020-11-24
    • 2022-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    相关资源
    最近更新 更多