在React Native中,borderRadius正在工作但是按钮的背景颜色保持正方形.这里发生了什么?
JS
<TouchableHighlight
style={styles.submit}
onPress={() => this.submitSuggestion(this.props)}
underlayColor='#fff'>
<Text style={[this.getFontSize(),styles.submitText]}>Submit</Text>
</TouchableHighlight>
Run Code Online (Sandbox Code Playgroud)
样式
...
submit:{
marginRight:40,
marginLeft:40,
marginTop:10,
},
submitText:{
paddingTop:20,
paddingBottom:20,
color:'#fff',
textAlign:'center',
backgroundColor:'#68a0cf',
borderRadius: 10,
borderWidth: 1,
borderColor: '#fff'
},
...
Run Code Online (Sandbox Code Playgroud)
我有一个在我的样式容器中的图标列表,显示在一个flexDirection:'row'但是当图标数量超过视图宽度时,它们不会中断到下一行,但继续向右看不到视图.如果内容达到最大宽度,如何让内容中断到下一行?
造型:
var styles = StyleSheet.create({
container: {
width: SCREEN_WIDTH, //width of screen
flexDirection:'row',
backgroundColor: 'transparent',
marginTop:40,
paddingLeft:10,
paddingRight:10,
flex: 1,
},
iconText:{
paddingLeft:10,
paddingRight:10,
paddingTop:10,
paddingBottom:10
},
});
Run Code Online (Sandbox Code Playgroud)
渲染:
<View style={styles.container}>
<TouchableHighlight
onPress={() => this.changeIcon(indexToChange, icons[0])}
underlayColor='#F7F7F7'>
<Text style={styles.iconText}><IonIcons name={icons[0]} size={30} color="#555" /></Text>
</TouchableHighlight>
<TouchableHighlight
onPress={() => this.changeIcon(indexToChange, icons[1])}
underlayColor='#F7F7F7'>
<Text style={styles.iconText}><IonIcons name={icons[1]} size={30} color="#555" /></Text>
</TouchableHighlight>
<TouchableHighlight
onPress={() => this.changeIcon(indexToChange, icons[2])}
underlayColor='#F7F7F7'>
<Text style={styles.iconText}><IonIcons name={icons[2]} size={30} color="#555" /></Text>
</TouchableHighlight>
...//more continued on
</View>
Run Code Online (Sandbox Code Playgroud)
当图标向右移动宽度时,它们不会向下突破.这可能吗?
如何调用该函数getClass的className这个例子里面?我写出来的方式似乎没有打电话getClass.
var CreateList = React.createClass({
getClass: function() {
//some code to return className
},
render: function() {
return(
<div className{this.getClass}>Example</div>
);
}
});
Run Code Online (Sandbox Code Playgroud) 我有一个 Next.js 应用程序正在部署到 Heroku。当我在本地开发时,我看到图像,但是当我推送到 Heroku 并检查站点时,图像出现 404。我有一个公共文件夹,其中图像 (.png) 就在文件夹中,以及我引用的代码像这样的图像
<Image
src="/wb_blue_white.png"
alt="WB Concept"
width="70"
height="70"
className={navStyles.logo}
/>
Run Code Online (Sandbox Code Playgroud)
无论是本地还是在产品中,如果我查看图像源,它们都是相同的src="/_next/image?url=%2Fwb_blue_white.png&w=256&q=75",但我在产品中得到 404。是什么导致图像显示在本地主机上,但不在 Heroku prod 构建中?
包.json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT"
},
Run Code Online (Sandbox Code Playgroud)
文件结构
components
pages
public
Run Code Online (Sandbox Code Playgroud) 我在其他应用程序中使用了ScrollView,只添加了一个style={styles.container}样式.然而,在这个程序我创造我的风格我有alignItems:'flex-start'与刚抛出一个错误style={styles.container},而是你需要传递的alignItems:'flex-start'通过contentContainerStyle={styles.container}.
错误: Invariant Violation: ScrollView child layout (["alignItems"]) must by applied through the contentContainerStyle prop.
但是当我contentContainerStyle在视图中向下滚动时添加时,一旦手指从手机上抬起(或在模拟器中释放鼠标),滚动会自动返回到顶部.如果我只是使用style={styles.container}并取出alignItems:'flex-start'它正确滚动,但我的UI中的项目没有列出我需要它们的方式.是什么导致它回滚到顶部contentContainerStyle并且有修复?
渲染:
var _that = this;
var iconsToShow = icons.map(function (icon, i){
if(i < 81){
return (
<TouchableHighlight
onPress={() => _that.changeIcon(indexToChange, icon)}
underlayColor='#F7F7F7'
key={i}>
<Text style={styles.iconText}><IonIcons name={icon} size={30} color="#555" /></Text>
</TouchableHighlight>
);
}
});
return (
<Carousel width={SCREEN_WIDTH} animate={false} indicatorColor="#444" inactiveIndicatorColor="#999" indicatorAtBottom={false} indicatorOffset={16}>
<View>
<ScrollView contentContainerStyle={styles.container}>{iconsToShow}</ScrollView>
</View> …Run Code Online (Sandbox Code Playgroud) 有没有办法将不透明度编码到这个多边形中?我正在尝试,但filter: drop-shadow( 6px 0 2px rgba(xxx,xxx,xxx,x.x))似乎没有工作.
这是一个jsfiddle:http://jsfiddle.net/buhL2wjb/
HTML:
<div class="container">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-right-arrow" viewBox="0 0 20 152" preserveAspectRatio="xMinYMid meet">
<polygon points="0,0 0,152 20,76"></polygon>
</svg>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.container{
width:500px;
height:300px;
border:1px solid lightgrey;
}
.svg-right-arrow{
height:100%;
-webkit-filter: drop-shadow( 6px 0 2px #000000 );
filter: drop-shadow( 6px 0 2px #000000 );
}
.svg-right-arrow polygon{
fill:lightblue;
}
Run Code Online (Sandbox Code Playgroud) 我发现在firebase中返回数据时child_added和之间有一点区别value.使用value我可以测试,看看是否snapshot.val()返回了一些东西,或者不使用它,如下所示:
获取数据:
ref.orderByChild('appUserName')
.equalTo(issuer)
.once('value')
.then(function (snapshot) {
var value = snapshot.val();
if (value) {
// Has Value...
}else{
//Has No Value...
}
Run Code Online (Sandbox Code Playgroud)
数据结构:
AppUsers --
234jl23jl4kj23 --
data --
//.. data
userName : "testUser1",
userPass: "password123"
9873h23foiu34u
//same structure
o8987s52df134o
//same structure
Run Code Online (Sandbox Code Playgroud)
如果我console.log返回了值,snapshot.val()它返回生成密钥级别的数据:
{234jl23jl4kj23 --
{data --
//.. data
userName : "testUser1",
userPass: "password123"}}
Run Code Online (Sandbox Code Playgroud)
如果我使用child_added以下数据获取数据:
ref.orderByChild('appUserName')
.equalTo(issuer)
.once('child_added')
.then(function (snapshot) {
var value = snapshot.val(); …Run Code Online (Sandbox Code Playgroud) 如果用户将手机上的选项设置为“缩放”,那么我正在开发的应用程序中的文本实际上会被缩小。(设置 > 显示和亮度 > 视图)
xcode 或我自己的代码中是否有一个选项可以解决此缩放问题。如果用户在手机上将“显示缩放”选项设置为“缩放”,则可能会禁用应用程序中的缩放视图。
标准视图:
设置:
缩放设置:
有解决办法吗?
我不确定这是一件事,还是可能和问题.我希望其他人也能体验到它.但每次我通过xcode在我的iphone上安装一个开发版,该应用程序在设备上工作正常,同时从计算机上拔下一周左右.然后应用程序在启动画面崩溃.我在设备上加载的应用程序的每个开发版都已完成此操作.甚至我从网上下载的示例应用程序.
应用程序的开发版本是否过期,或者证书是否过期或导致设备上的应用程序在设备上运行一段时间后开始崩溃的其他问题?
如果我得到这样的输入
0x18cbafe5000000000000000000000000000000000000000000000001885c663d0035bce200000000000000000000000000000000000000000000000000f5666f7fdaa62600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000c0be713b48822271b362e9fac00479f5134172e80000000000000000000000000000000000000000000000000000000060e93fa900000000000000000000000000000000000000000000000000000000000000020000000000000000000000009813037ee2218799597d83d4a5b6f3b6778218d9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
如果我有这样的函数签名,"swapExactTokensForETH(uint256,uint256,address[],address,uint256)"
是否可以在没有 ABI 的情况下进行解码?
我从签名中知道类型
"types": [
"uint256",
"uint256",
"address[]",
"address",
"uint256"
],
Run Code Online (Sandbox Code Playgroud)
但解码后看起来像这样:
"inputs": [
"1885c663d0035bce2",
"f5666f7fdaa626",
[
"9813037ee2218799597d83d4a5b6f3b6778218d9",
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"c0be713b48822271b362e9fac00479f5134172e8",
"60e93fa9"
]
Run Code Online (Sandbox Code Playgroud)
其中索引0是uint256,索引1是下一个uint256,索引2是address[],索引3是地址,索引4是uint256
那么有什么逻辑可以知道索引2中的数组是从交易输入末尾的两个地址中拉取的。
如果可能的话,我尝试不需要 ABI 来解码输入
我知道我可以像这样分割交易的输入:
['000000000000000000000000000000000000000000000001885c663d0035bce2','000000000000000000000000000000000000000000000000000f566 6f7fdaa626', '0000000000000000000000000000000000000000000000000000000000000a0', '000000000000000000000000c0be713b48822271b362e 9fac00479f5134172e8','0000000000000000000000000000000000000000000000000000000060e93fa9','0000000000000000000000000000000000000 000000000000000000000000002', '0000000000000000000000009813037ee2218799597d83d4a5b6f3b6778218d9', '000000000000000000000000c02 aaa39b223fe8d0a0e5c4f27ead9083c756cc2']
该数组中的最后两个是上面输入数组中索引 2 显示的地址。但是函数签名的顺序是第三,我怎么知道它是从最后的输入中拉出来的呢?
这是 abi 发挥作用的地方,就像使用 web3 进行解码一样?或者没有abi 也可以解码吗?
javascript ×5
react-native ×5
ios ×2
reactjs ×2
css ×1
dropshadow ×1
ethereum ×1
firebase ×1
flexbox ×1
heroku ×1
html ×1
next.js ×1
nextjs-image ×1
opacity ×1
scrollview ×1
styles ×1
svg ×1
transactions ×1