我正在使用 Wix 的 react-native-navigation V2。我想给 topBar 渐变颜色。我已经成功安装了 react-native-linear-gradient。但我不知道如何为 topBar 提供渐变颜色。
以下是将屏幕压入堆栈的代码。
Navigation.push('mainStack', {
component: {
name: 'SignIn',
options: {
topBar: {
visible: true,
animate: false,
//hideOnScroll: true,
//buttonColor: 'white',
drawBehind: false,
title: {
text: 'Sign In',
fontSize: 18,
//color: 'white',
fontFamily: 'Ubuntu',
alignment: 'center'
},
backButton: {
// icon: require('icon.png'),
id: 'backButton',
visible: true,
//color: 'white'
},
background: {
color: '#1abc9c'
}
},
sideMenu: {
left: {
enabled: false
}
},
animations: {
push: { // It works! Push with animation from right to left
content: {
x: {
from: 1000,
to: 0,
duration: 100,
},
alpha: {
from: 1,
to: 1,
duration: 100,
}
}
},
pop: { // It works! Pop with animation from left to right
content: {
x: {
from: 0,
to: 1000,
duration: 50,
},
alpha: {
from: 1,
to: 1,
duration: 50,
}
}
}
}
}
}
});
我试图在下面的选项中提供渐变颜色
background: {
color: <LinearGradient colors={['#a8ff78', '#78ffd6']} style={styles.container} />
}
但它不起作用。