最近我一直对此感到困惑,我希望根据是否选择/激活地图标记来动态更新地图标记图像(每个MapMarker都有一个类别引用活动图像或默认图像来自两个图像集合:interestIcons和interestIconsSelected.基本上我有一个MapMarkers集合,它们通过map标记集合进行映射.每个MapMarker都是MapView.Marker的子组件.
我想将所有MapMarkers渲染为默认的非选择/非活动状态,其中包含来自interestIcons的默认图像,当选中时,MapMarker图像应该从interestIconsSelected更改为活动图像,当选择另一个MapMarker时,之前选择的应该是恢复为默认图像,新的应更改为所选图像.
目前,我能够使用默认图像渲染地图标记,但是当选择地图标记时,图像似乎不会立即更改,除非您再次缩小/放大,即导致某种重新渲染,我想这样点击MapMarker会立即导致图像更新.
MapScreen.js: 通过地图渲染所有MapView.Marker MapMarkers的MapView.
<MapView
ref={map => { this._map = map }}
style={Styles.Map.map}
initialRegion={this.props.region}
onRegionChange={this.handleRegionChange}
>
{
this.props.events
.filter(this.eventFilterTimeNearFuture)
.filter(this.eventFilterTimeNotPast)
.filter(this.eventFilterDistance)
.filter(this.eventFilterInterest)
.map(e =>
<MapView.Marker
key={e.id}
onPress={() => this.handleLocationPush(e)} // Set selected event state
coordinate={e.location}
>
<MapMarker
event={e}
size={this.state.markerSize}
selected={this.state.selectedEvent} // The selected event set by state call.
/>
</MapView.Marker>
)
}
{ !this.props.regionMock &&
<MapView.Marker
key={'userLocation'}
coordinate={this.props.region}
>
<MapMarker size={'user'} />
</MapView.Marker>
}
</MapView>
Run Code Online (Sandbox Code Playgroud)
MapMarker.js
import {interestIcons, interestColors, interestIconsSelected} from "../../utils/Icons";
import {Styles} from '../../StyleProvider';
class MapMarker …Run Code Online (Sandbox Code Playgroud) 我最近一直在实施地图框,我已经更新到最新版本的react-native,gradle,以及什么不是.该应用程序在调试模式下运行绝对正常,但只要我在发布模式下运行它就会立即崩溃,完全没有警告屏幕.我正在使用新的propTypes,依此类推.
请参阅输出日志
好的,我道歉,虽然上面的工作在调试模式,应用程序现在崩溃时,建立一个版本,我很困惑.
我正在尝试构建一个版本,虽然在调试模式下工作正常但崩溃了:
11-23 00:48:14.499: E/SDAgentPackageStateReceiver(6040): Not going to handle 'com.goclustr.clustr'!
11-23 00:48:14.704: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.720: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.735: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.884: E/Launcher.Model(1564): onPackageAdded :com.goclustr.clustr
11-23 00:48:14.906: E/ApplicationPackageManager(1564): checkSettingsForIconTray value : 0
11-23 00:48:14.907: E/ApplicationPackageManager(1564): checkSettingsForIconTray value : 0
11-23 00:48:15.589: E/ReflectField(20468): Incorrect type : Fallback exception
11-23 00:48:15.589: E/ReflectField(20468): Incorrect type : Fallback exception
11-23 00:48:15.778: E/SemAffinityControl(20435): SemAffinityControl: registerfunction enter
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor …Run Code Online (Sandbox Code Playgroud) gradle android-gradle-plugin react-native react-native-android
我对Cloud Firestore特别安全的角色相当新,但由于它们非常重要,我宁愿启动围绕它们的项目的新构建.
现在作为一个基本的见解,我有一个仪表板,用户必须使用他们的电子邮件地址和密码登录,然后他们可以访问区域信息等数据.从安全规则开始,我认为我开始时很简单,但正如标题所述我得到的:
Error: Missing or insufficient permissions
我查看了https://firebase.google.com/docs/firestore/solutions/role-based-access
service cloud.firestore {
match /databases/{database}/documents {
match /regions/{region} {
function isSignedIn() {
return request.auth != null;
}
function getRole(rsc) {
// Read from the "roles" map in the resource (rsc).
return rsc.data.roles[request.auth.uid];
}
function isOneOfRoles(rsc, array) {
// Determine if the user is one of an array of roles
return isSignedIn() && (getRole(rsc) in array);
}
// Any role can read regions.
allow read: if isOneOfRoles(resource, ['owner', 'writer', 'commenter', 'reader']); …Run Code Online (Sandbox Code Playgroud) firebase reactjs google-cloud-firestore firebase-security-rules
从与 iOS 的链接启动时,会不断返回以下内容,但 Android 工作正常。
{"+is_first_session":false,"+clicked_branch_link":false,"+non_branch_link":" https://yourapp.app.link/?someparam=123 "}
我刚刚开始使用 React Native Branch,我已经到了我的 Android 应用程序通过提供的链接打开的程度,并且正在成功订阅并通过传入的参数识别分支链接,但是当涉及到 iOS 应用程序时该应用程序按照链接成功打开,并订阅,它似乎没有识别分支链接,也没有在传入参数时识别。
我AppDelegate.m按照要求修改了:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
NSURL *jsCodeLocation;
Run Code Online (Sandbox Code Playgroud)
添加了打开 URL(已有 FBSDKApplicationDelegate)
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
if (![RNBranch.branch application:application openURL:url options:options]) {
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
return YES;
// Add any custom logic here.
return …Run Code Online (Sandbox Code Playgroud) 我有一个问题,ScrollViewClass是未定义的,但仅在应用程序的一个位置,仅适用于react-native中的iOS版本.
ScrollView在应用程序中的多个位置使用并且工作正常但在应用程序的这个特定部分中,它会导致错误屏幕指出 ScrollViewClass must not be undefined
<ScrollView style={styles.descriptionContainer}
contentContainerStyle={styles.descriptionContainerInner}>
{/* The description text */}
<Text style={styles.descriptionText}>
{this.state.description}
</Text>
</ScrollView>
Run Code Online (Sandbox Code Playgroud) react-native ×4
ios ×2
reactjs ×2
branch.io ×1
deep-linking ×1
firebase ×1
gradle ×1
scrollview ×1