I am trying to reuse some components built for web application using reactjswith radium.
I have a component which contains outline css property . I reuse the component , unfortunalty , i got this error :
My questions are :
What is the alternative of outline property in react-native for both ios or android ?
Is there alternative of radium in react-native ?
Should I manage manually this difference of style properties naming among iOs DEV, android DEV as well as web DEV ?
I think you are looking for the border styles.
More specifically from the facebook react native docs:
borderWidth ReactPropTypes.number
borderStyle ReactPropTypes.oneOf(['solid', 'dotted', 'dashed'])
So for instance if you wanted to make a 10 x 10 box with dashed lines...
<View style={{ borderWidth:1, borderStyle: 'dashed', width: 10, height: 10, }} />
Related
I using custom font for my Flutter app:
return MaterialApp (
theme: ThemeData(
fontFamily: "MyFont"
)
)
but in one place of application I need to use "system font". this is especially important for iOS (Sf Pro). If I understand correctly, this is the system font for iOS. But how can I use "system font" if I already use "custom font" at application level?
I tried:
final fontFamily = DefaultTextStyle.of(context).style!.fontFamily;
But this code return "MyFont".
also I tried importing from apple site. but there is only one big SF-Pro.ttf(8Mb) file inside the image. Not - SFPro-Regular.ttf, SFPro-SemiBold.ttf ... Flutter does not support .otf files.
How to solve this problem? any advice I will be grateful
This may seem like a duplicate but I've followed the answers to maybe a dozen similar questions on Stack and none of the solutions are working for me.
The React Native docs say load to local images like so:
<Image source={require('./my-icon.png')} />
I've placed the image 3D-home2#x.jpg in the same folder as the JS file:
I also tried placing it at the project root:
I also tried placing it in Images.xcassets and loading it like require('image!3D-home').
In between these efforts, I cleared the module cache several times with yarn start -- --reset-cache. Did a full XCode project 'clean' several times and rebuilt the app. No matter what I do I get some variation of this error (project name redacted):
What am I doing wrong here? It seems like I'm following the instructions exactly but I cannot get an image to load.
<Image
style={{
position: 'absolute',
width: '100%',
height: '100%',
top: 0,
left: 0,
zIndex: 10
}}
source={ require('./3D-home#2x.jpg') }
/>
The solution was to remove #2x from the file name. This is because React Native offers the ability to automatically swap out images using suffixes, so I was unwittingly trying to do that incorrectly or something:
You can also use the #2x and #3x suffixes to provide images for
different screen densities.
https://facebook.github.io/react-native/docs/images.html
i'm currently using react native ART module, and everything is ok except the Text component, but the bug is only happening in iOS, in android everything seems to work as expected.
When i try to use the Text component in iOS react trows an this error:
Image Output Error in App
And in Xcode console output's this:
2016-09-20 17:17:17.663 [error][tid:main][RCTConvert.m:57] Error setting property 'frame' of ARTText with tag #7: JSON value '' of type NSNull cannot be converted to NSDictionary
Since react native ART doesn't have documentation, it's very possible that I'm not doing something right, but I already read the source code and nothing is working that I try.
Additional Information:
React Native version:0.33.0
Platform: iOS
Operating System: macOS
Xcode: 8.0
RnPlay is down so i'm gonna post the code here:
https://jpst.it/NAac
As soon as the RNplay is up, i will update this post and put the code there.
Was having this error myself too, turns out that you need to provide the font property, according to this issue
Copied from there
<ARTText font={`13px "Helvetica Neue", "Helvetica", Arial`} fill="#000000" x={16} y={16}>Hello</ARTText>
You can specify font values this way, which works on both iOS and Android:
<ART.Text
font={{
fontFamily: 'Helvetica Neue',
fontSize: 13,
}}
fill="#000000"
x={16}
y={16}
>
Hello
</ARTText>
Other attributes, as discerned from the source code, are:
fontWeight: (number | 'bold' | 'normal')
fontStyle: ('italic' | 'normal')
I have tried many different libraries, but none came.
None of them can not be specified without introducing his own style in Painter.
I need to be able to quickly and dynamically change the style tab.
In response, I showed my developments.
If someone has similar developments - write them in response.
I decided to upgrade the simplest of them: TJvTabBar of JVCL (latest revision: 13415)
Here is the result.
Before (default)
After
Style sources (All graphics imported from png files with transparency)
Easy apply any personal style to any JvTabBar
var tmp:TStrings;
begin
tmp:=TStringList.Create;
tmp.Values['TOP_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_background.png';
tmp.Values['TOP_active_left_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_left_side.png';
tmp.Values['TOP_active_right_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_right_side.png';
tmp.Values['TOP_active_center']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_center.png';
tmp.Values['BOTTOM_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_background.png';
tmp.Values['BOTTOM_active_left_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_left_side.png';
tmp.Values['BOTTOM_active_right_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_right_side.png';
tmp.Values['BOTTOM_active_center']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_center.png';
tmp.Values['CLOSEBUTTON_normal']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_normal.png';
tmp.Values['CLOSEBUTTON_selected']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_selected.png';
tmp.Values['CLOSEBUTTON_disabled']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_disabled.png';
tmp.Values['CLOSEBUTTON_closing']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing.png';
tmp.Values['CLOSEBUTTON_modified']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_modified.png';
tmp.Values['CLOSEBUTTON_closing_modified']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing_modified.png';
JvTabBar1.StyleImages:=tmp;
tmp.Values['BOTTOM_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\MYMOD_tabs-BOTTOM_background.png';
JvTabBar2.StyleImages:=tmp;
Main changes
Added ability to specify their own style ( JvTabBar1.StyleImages )
Added the ability to move the close button to the right ( JvTabBar1.CloseButtonRight: = true or false )
Many fixes to the size and position of text / icons / buttons / scroll
My JvTabBar.pas mod You can download it here http://pastebin.com/JmbufHy0
And example source style + JvTabBar.pas http://www.sendspace.com/file/shhuzr
I need to use viewport on a page where all I can change is CSS. That means that I don't have an access to HTML, so I can't put the famous meta-tag there.
The only possible option I have found which could work is
#viewport {
width: device-width;
initial-scale: 1;
zoom: 1;
min-zoom: 1;
max-zoom: 2;
zoom: fixed;
}
But I didn't manage to get a proper result. It still saves the same width when I am rotating the device.
Does anybody have some ideas what should I change? Or is it possible at all?
As of writing this (Dez '13), the CSS Device Adaption (including #viewport) is not ready to use and has far from perfect browser support. Therefor, setting a viewport for iOS only through CSS is currently not possible.
Browser support:
Internet Explorer 10 (msdn.microsoft.com) – vendor-prefixed: #-ms-viewport
Opera Mobile 11 (dev.opera.com) – vendor-prefixed: #-o-viewport
Further information:
html5hacks.com: Elegantly Resize Your Page With the #-viewport CSS Declaration
treehouse blog: CSS Device Adaptation With #viewport
As of the Bootstrap documentation IE10 in Windows 8 and Windows Phone 8 need some fixes to work properly:
Internet Explorer 10 in Windows 8 and Windows Phone 8
Internet Explorer 10 doesn't differentiate device width from viewport width, and thus doesn't properly apply the media queries in Bootstrap's CSS. Normally you'd just add a quick snippet of CSS to fix this:
#-ms-viewport { width: device-width; }
However, this doesn't work as it causes Windows Phone 8 devices to show a mostly desktop view instead of narrow "phone" view. To address this, you'll need to include the following CSS and JavaScript to work around the bug until Microsoft issues a fix.
CSS:
#-webkit-viewport { width: device-width; }
#-moz-viewport { width: device-width; }
#-ms-viewport { width: device-width; }
#-o-viewport { width: device-width; }
#viewport { width: device-width; }
JS:
if (navigator.userAgent.match(/IEMobile/10.0/)) {
var msViewportStyle = document.createElement("style")
msViewportStyle.appendChild(
document.createTextNode(
"#-ms-viewport{width:auto!important}"
)
)
document.getElementsByTagName("head")[0].appendChild(msViewportStyle)
}
For more information and usage guidelines, read Windows Phone 8 and Device-Width.