我试图获得视图的滚动位置.但Y偏移到页面的值与视图的位置无关.
ScrollView层次结构:
<ScrollView>
- MyComponent1
- MyComponent2
- SubView1
- SubView2
- <View> (Added ref to this view and passing Y offset value through props)
- MyComponent3
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
SubView2组件:
this.myComponent.measure( (fx, fy, width, height, px, py) => {
console.log('Component width is: ' + width)
console.log('Component height is: ' + height)
console.log('X offset to frame: ' + fx)
console.log('Y offset to frame: ' + fy)
console.log('X offset to page: ' + px)
console.log('Y offset to page: ' + py) …Run Code Online (Sandbox Code Playgroud) 我通过终端创建了新的react-native项目.
react-native init PlayWithAnimation
Run Code Online (Sandbox Code Playgroud)
当我通过Xcode运行react-native应用程序时.我收到了这个错误.
/ bin/sh -c \"/ Users/sumit/Desktop/React\Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh \"
/ Users/sumit/Desktop/React> Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh:line 2:cd:/ Users/sumit/Desktop/React:没有这样的文件或目录
/ Users/sumit/Desktop/React> Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh:line 3:/ Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh:没有这样的文件或目录
/ Users/sumit/Desktop/React Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh:line 3:exec:/ Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh:无法执行:没有这样的文件或目录
以下构建命令失败:
PhaseScriptExecution安装\ Third\Party/Users/sumit/Desktop/React\Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1次失败)
这些是我用过的版本:
node v8.0.0
npm 5.0.3
react-native-cli: 2.0.1
react-native: 0.46.0
xcode 8.3.3
Run Code Online (Sandbox Code Playgroud)
我检查过与其他stackoverflow Q&A相关但没有得到正确的解决方案.
临时解决方案:
如果我创建react-native,它会顺利运行version="0.44.0".但是在version 0.45.0, 0.46.0, 0.47.0构建中失败了,同样的"双转换"问题也随之而来.还有一件事,当我创建新项目时,第三方目录丢失了.
node_modules/react-native/ (missing third-party directory)
Run Code Online (Sandbox Code Playgroud)
会出现什么问题?
尝试解决方案1:
我做了以下步骤:
下载.sh中所需的文件,将其放在〜/ .rncache /中.
将下载的文件复制到node_modules/react-native/third-party /中,对每个文件运行tar -zxf***.
再建一次.但没有奏效.
试过的解决方案2:
处理react-native 0.46x上的第三方构建错误. 并尝试使用github问题.
我很高兴最终开始使用React Native,但是这个bug绝对会让我无法继续.如果有人可以帮我解决这个问题,我真的很感激.
xcode ios react-native react-native-android react-native-ios
我想将此数据数组过滤为州和城市数组.我怎样才能使用lodash或任何其他更好的方式实现这一点,而不是循环和维护额外的数组.
data: [
{ id: 1, name: Mike, city: philps, state: New York},
{ id: 2, name: Steve, city: Square, state: Chicago},
{ id: 3, name: Jhon, city: market, state: New York},
{ id: 4, name: philps, city: booket, state: Texas},
{ id: 5, name: smith, city: brookfield, state: Florida},
{ id: 6, name: Broom, city: old street, state: Florida},
]
Run Code Online (Sandbox Code Playgroud)
用户点击state,状态列表出现.
{state: New York, count: 2},
{state: Texas, count: 1},
{state: Florida, count: 2},
{state: Chicago, count: …Run Code Online (Sandbox Code Playgroud) 我有一个要求,其中视图需要位于底部的中心并根据其内容调整高度。因此constraint layout在 root 内部创建constraint layout以实现此目的。但现在我面临动画问题。我无法申请constraintSet。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#BEE">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/error_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="40dp"
android:background="#FFF"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/error_try_again"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="12dp"
android:textStyle="bold"
android:minWidth="180dp"
android:text="Try again"
android:textAlignment="center"
android:textColor="#000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/error_subtitle" />
<TextView
android:id="@+id/error_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:textStyle="bold"
android:text="We are unable to find the object"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="21sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/error_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="6dp" …Run Code Online (Sandbox Code Playgroud) 这是减速器状态。我需要添加、更新、删除cartData 中的对象。第一次,cartData 为空。
const initialState = {
fetchData: {},
cartData: {}
}
Run Code Online (Sandbox Code Playgroud)
例子:
fetchData: {
"React":{'name': 'React'},
"Node":{'name': 'Node'},
}
Run Code Online (Sandbox Code Playgroud)
如果用户ADD_ITEM反应书,新项目将添加到这里的购物车中。
cartData:{
"React":{'name': 'React', 'quantity': 1},
}
Run Code Online (Sandbox Code Playgroud)
如果用户Edit_ITEM反应书籍,则现有项目将在此处更新。
cartData:{
"React":{'name': 'React', 'quantity': 4},
}
Run Code Online (Sandbox Code Playgroud)
如果用户REMOVE_ITEM反应书,当它在这里归零时删除。
cartData:{
}
Run Code Online (Sandbox Code Playgroud)
我们如何修改这些操作的 redux 状态?
试过这个:使用lodash. 但没有正确解决。
case types.ADD_ITEM:
return { ...state, cartData: // add new item }
case types.EDIT_ITEM:
return { ...state, [state.cartData.name]: action.payload }
case types.REMOVE_ITEM:
return _.omit(state, [state.cartData.name]: action.payload)
Run Code Online (Sandbox Code Playgroud) 需要react-navigation从手机重用代码react-native-web。但是我无法在网络上运行它。
我们是否需要react-router单独使用网络?
我们如何为两个平台共同配置导航?我希望看到一个例子!这将超级有帮助。谢谢!!
reactjs react-router react-native react-navigation react-native-web
我需要更新状态更改,例如 android 和 react 本机类之间的事件?
public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "Push Message Received ");
buildLocalNotification(remoteMessage);
}
public void buildLocalNotification(RemoteMessage message) {
...
FBMessagingHelper notificationHelper = new FBMessagingHelper(this.getApplication());
notificationHelper.showNotification(bundle);
}
}
Run Code Online (Sandbox Code Playgroud)
ReactApplicationContext当类扩展到 FBMessingService 时,如何创建构造函数?
FBMessagingHelper notificationHelper = new FBMessagingHelper(this.getApplication());
// Getting Error as a parameter is not react app context
Run Code Online (Sandbox Code Playgroud)
我需要更新IN_VIDEO_PROGRESS状态
Android视频开始/停止时间React Native。React Native视频开始/停止时间Android。public class FBMessagingHelper extends ReactContextBaseJavaModule {
private …Run Code Online (Sandbox Code Playgroud) 我正在创建用于通过桥接进行本机反应的 cameraX 视图。(在 RN 中渲染正常视图。桥接流程很好。)PreviewView用于显示 CameraX 预览的相机馈送。我已成功实现预览,但不确定为什么预览未在 UI 上呈现。它只是一个空白屏幕。
让我知道 UI 原生组件的正确实现方式。我在活动中厌倦了同样的事情并且工作正常。我是 android 平台的新手。提前致谢!
https://groups.google.com/a/android.com/g/camerax-developers/c/G9jKs1Bo_CE 检查了这个。但不确定问题是否与重新布局有关。
从 NativeCameraView 类登录:
23:21:45.415 8026-8026/com.app D/PreviewView: Surface requested by Preview.
11-11 23:21:45.415 8026-8784/com.app D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-ee9dbc80-160c-45e5-a38f-e68bc8f54373, androidx.camera.core.Preview-3e33af92-3cb6-4cb4-a0c3-dfb4e3c6cc8d] for camera: 0
11-11 23:21:45.415 8026-8784/com.app D/UseCaseAttachState: Active and attached use case: [androidx.camera.core.Preview-3e33af92-3cb6-4cb4-a0c3-dfb4e3c6cc8d] for camera: 0
11-11 23:21:45.416 8026-8784/com.app D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-ee9dbc80-160c-45e5-a38f-e68bc8f54373, androidx.camera.core.Preview-3e33af92-3cb6-4cb4-a0c3-dfb4e3c6cc8d] for camera: 0
11-11 23:21:45.416 8026-8784/com.app D/UseCaseAttachState: Active and attached use case: [androidx.camera.core.Preview-ee9dbc80-160c-45e5-a38f-e68bc8f54373, androidx.camera.core.Preview-3e33af92-3cb6-4cb4-a0c3-dfb4e3c6cc8d] for camera: 0 …Run Code Online (Sandbox Code Playgroud) 我想获取当前增益的值并更改 RGB 增益的值。
在 iOS 中,Apple提供了 setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler.
- (void)setWhiteBalanceGains:(AVCaptureWhiteBalanceGains)gains
{
NSError *error = nil;
if ( [self.captureDevice lockForConfiguration:&error] ) {
AVCaptureWhiteBalanceGains normalizedGains = [self normalizedGains:gains];
[self.captureDevice setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:normalizedGains completionHandler:nil];
[self.captureDevice unlockForConfiguration];
}
else {
NSLog( @"Could not lock device for configuration: %@", error );
}
}
- (AVCaptureWhiteBalanceGains)normalizedGains:(AVCaptureWhiteBalanceGains) g
{
AVCaptureWhiteBalanceGains gains = g;
gains.redGain = MAX(gains.redGain, 1.0f);
gains.greenGain = MAX(gains.greenGain, 3.0f);
gains.blueGain = MAX(gains.blueGain, 18.0f);
return gains;
}
Run Code Online (Sandbox Code Playgroud)
我们如何使用cameraX在android中实现这一点?
COLOR_CORRECTION_GAINS
COLOR_CORRECTION_MODE
我已经检查了有关通道控制的文档。但是我们如何使用新控件更改色彩校正并重置 cameraX 预览?
背景透明度与BLUR
是否可以在不使用背景图像的情况下模糊视图?我想在模态中的背景模糊视图上显示父内容.
类似的这种:

尝试使用react-native-blur:
它实际上模糊了背景图像.我想模糊并显示模态背后的内容.
尝试与react-native-overlay:但没有变化.
我需要在 ofbased on the index value的位置替换 boldText{index}并且那个词应该是bold。
例子:
{
sentence: {0} and {1} are great
boldText: ['You', 'Your Family']
}
Run Code Online (Sandbox Code Playgroud)
输出:
你和你的家人都很棒。
react-native ×9
android ×4
javascript ×4
reactjs ×4
ios ×2
arrays ×1
blur ×1
blurry ×1
bridge ×1
filter ×1
grouping ×1
lodash ×1
react-router ×1
redux ×1
scrollview ×1
uiblureffect ×1
uiscrollview ×1
view ×1
xcode ×1