Elements upside down when adding library - iOS only
chiechelski opened this issue · 24 comments
Hi there,
We couldn't find any solution or someone having a similar issue, so hopefully, you guys can help us out.
It seems that every time we include react-native-unity-view
, link files and include the UnityExport files, the react native elements turn upside down. We can fix a few screens by adding flexDirection: "column"
, but that seems too odd to be happening only in iOS.
Here is an example of our screen before including the files
And here is after
Any idea what to do?
@chiechelski I'm running into this same issue on RN 0.59.0+. Does that match your version, and have you found a solution?
Hey @kevinsperrine ,
Unfortunately not.
But my workaround was to add flexDirection: 'column'
to all my containers styles.
And on the ScrollViews add to the contentContainerStyle.
Eg.:
<ScrollView
style={[styles.container]}
contentContainerStyle={{ flexDirection:'column' }}
>
Let me know if you find anything.
Cheers
@chiechelski This is going to sound absolutely stupid, but are you using Pods in your project and are you doing a #include "Pods/Target Support Files/blah/blah.xcconfig"
at the top of your UnityConfig.xcconfig files? If so, try moving the include to the bottom of the UnityConfig instead, clean the project, and try a rebuild.
I've having the same issue with RN 0.59.0+
, have you managed to fix it somehow?
@fluiddot I managed to make it work by changing the pods file include as mentioned above. By combining the two configs (unity and pods) together I was able to make it work. I have no idea what part of the ordering or inclusion process is causing it, but that's what fixed it for me.
It worked like charm! Thanks @kevinsperrine!
I'm wondering what's the casing the issue...
@kevinsperrine Hey, facing the same issue here. Have tried your suggestion and it seems not to work for me. Can you share your unity config file? Thanks.
FYI:
"react": "16.8.3"
"react-native": "0.59.9"
// UnityConfig.xcconfig
// rnunitydemo
//
// Created by xzper on 2018/3/6.
// Copyright © 2018年 Facebook. All rights reserved.
//
// Originally I was including my pods file here like so:
// #include "Pods/Target Support Files/Pods-aramis/Pods-aramis.release.xcconfig"
// However, when including it at the top of the config all of the elements were upside down,
// but if I moved it to the bottom after all of the unity declarations it works as expected... 🤷♂
UNITY_SCRIPTING_BACKEND = il2cpp;
GCC_PREFIX_HEADER = $(SRCROOT)/UnityExport/Classes/Prefix.pch;
HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Classes" "$(SRCROOT)/UnityExport/Classes/Unity" "$(SRCROOT)/UnityExport/Classes/Native" "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" ${PODS_HEADER_PATHS};
LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" ${PODS_LIBRARY_PATHS};
// If using .net 4.0 in Unity, append -DNET_4_0 to OTHER_CFLAGS
OTHER_CFLAGS = $(inherited) -DINIT_SCRIPTING_BACKEND=1 -fno-strict-overflow -DRUNTIME_IL2CPP=1 -DNET_4_0;
OTHER_LDFLAGS = $(inherited) -weak-lSystem -weak_framework CoreMotion -weak_framework GameKit -weak_framework iAd -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework Foundation -framework MediaPlayer -framework MediaToolbox -framework Metal -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -liPhone-lib -lil2cpp ${PODS_LIBRARIES};
CLANG_CXX_LANGUAGE_STANDARD = c++0x;
CLANG_CXX_LIBRARY = libc++;
CLANG_ENABLE_MODULES = NO;
CLANG_WARN_BOOL_CONVERSION = NO;
CLANG_WARN_CONSTANT_CONVERSION = NO;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
CLANG_WARN_EMPTY_BODY = NO;
CLANG_WARN_ENUM_CONVERSION = NO;
CLANG_WARN_INT_CONVERSION = NO;
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_UNREACHABLE_CODE = NO;
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_THUMB_SUPPORT = NO;
GCC_USE_INDIRECT_FUNCTION_CALLS = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION[arch=*64] = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = NO;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNUSED_FUNCTION = NO;
ENABLE_BITCODE = NO;
DEAD_CODE_STRIPPING = YES;
// Moved the pods include to the bottom and it works...
#include "Pods/Target Support Files/Pods-aramis/Pods-aramis.release.xcconfig"
@HotWordland Hey, make sure in your .xcconfig
file you add Unity paths first
i.e:
HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Classes" "$(SRCROOT)/UnityExport/Classes/Unity" "$(SRCROOT)/UnityExport/Classes/Native" "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" (.... your other paths)
LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/NatCorder/Plugins/iOS" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" (.... your other paths)
@Deishelon thanks , but I don't have it . xcconfig file . My project is Unity3D. I didn't integrate react-native before. After integration, I found that the page elements written with react-native are upside down.
@HotWordland You gotta have a custom UnityConfig.xcconfig
-> https://github.com/f111fei/react-native-unity-demo/blob/master/ios/rnunitydemo/UnityConfig.xcconfig
Alternatively, you can temporarily modify *.xcconfig
in Pods
folder, but it will be overridden next time you do a pod install
@Deishelon It's work for me great ! thanks . 👍
@HotWordland 我有和你一样的问题,方便聊一下吗,我也是unity导出的项目,通过node_modules集成到iOS里,
"react": "^17.0.1",
"react-native": "0.63.3", 我也没有UnityConfig.xcconfig文件,不知道怎么处理了,希望能帮我解答一下。
@kevinsperrine @Deishelon I don't have . xcconfig file , but i have a custom UnityConfig.xcconfig,and moved the pods include to the bottom But it's useless,Can you give me some help,i use cocoapods , "react": "^17.0.1", "react-native": "0.63.3"
@HotWordland 我有和你一样的问题,方便聊一下吗,我也是unity导出的项目,通过node_modules集成到iOS里,
"react": "^17.0.1",
"react-native": "0.63.3", 我也没有UnityConfig.xcconfig文件,不知道怎么处理了,希望能帮我解答一下。
我记得 把 UnityConfig.xcconfig
这个文件加到主项目的根路径就可以了... 没有的话 看这个 https://github.com/f111fei/react-native-unity-demo/blob/master/ios/rnunitydemo/UnityConfig.xcconfig 创建一个就可以了 这里记录了一下 http://codercq.com/d/25 另外我的rn
版本是 0.59
@HotWordland 我在根目录添加了,但是不行,你看看,我加的有问题吗
@HotWordland 我在根目录添加了,但是不行,你看看,我加的有问题吗
不用 直接 文件名 叫 UnityConfig.xcconfig
然后拖入主项目里面就行 你试一下
@HotWordland 我试过,还是不行,我的pods文件有很多个,我在下面include哪一个,我的unity.xcconfig里应该写什么内容,我是直接把我的pods.coconfig里的内容,直接复制过来的,这样对吗?还有就是unity.xcconfig就是单纯拖到工程里,什么都不需要做吗?困扰我很久了,麻烦你了。
@HotWordland 我试过,还是不行,我的pods文件有很多个,我在下面include哪一个,我的unity.xcconfig里应该写什么内容,我是直接把我的pods.coconfig里的内容,直接复制过来的,这样对吗?还有就是unity.xcconfig就是单纯拖到工程里,什么都不需要做吗?困扰我很久了,麻烦你了。
@HotWordland 我是这样的,导出unity的iOS项目,然后把这个项目集成cocoapods,通过cocoapods再集成react-native的环境,再把react-native打包成iOS用的jsbundle,jsbundle放到unity导出的iOS项目里,然后写相关代码调用jsbundle,加载到unity的UnityAppController上,做展示。
@HotWordland 我是这样的,导出unity的iOS项目,然后把这个项目集成cocoapods,通过cocoapods再集成react-native的环境,再把react-native打包成iOS用的jsbundle,jsbundle放到unity导出的iOS项目里,然后写相关代码调用jsbundle,加载到unity的UnityAppController上,做展示。
你看下 第4步 项目里面有没有配置选中 UnityConfig.xcconfig
@HotWordland 我配置了,我想问一下,在UnityConfig.xcconfig,我应该写什么东西,是直接把你给的链接里的内容直接复制过来就可以吗?你看看我写的对吗
@HotWordland 我的qq号:937840988,方便加个qq聊一下吗,我这卡好久了,一直没搞出来,希望能帮我看看