pjjanak / react-native-viewport Goto Github PK
View Code? Open in Web Editor NEWUtility to get current size of the viewport.
License: MIT License
Utility to get current size of the viewport.
License: MIT License
Hi and thanks for creating this module. I initially received a warning when trying to run my app with the Viewport install, it said that Viewport was not exported and did I forget to use RCT_EXPORT_MODULE()? I have added it as follows in Viewport.m and all seems to work. Is this correct?
...
@implementation Viewport
{
NSDictionary *_lastKnownDimensions;
}
RCT_EXPORT_MODULE()
...
Thanks for creating this library.
Am curious about how to implement it for (what I would guess) is a common use-case: many components that change based on orientation and/or device size.
or
There are cases where we would want many components to update autonomously (ex: width,height,placement,etc) relative to screen size/orientation.
Should components that all need viewport information subscribe to viewport events independently? Seems like potentially a lot of subscriptions.
Thanks in advance
I cant load the module and I followed all steps very carefully.
Launching Dev Tools...
Unable to resolve module ./base64-vlq from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./array-set from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./base64 from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./binary-search from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./array-set from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./base64-vlq from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./source-map-generator from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-map-consumer from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-map-generator from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-node from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module RCTDeviceEventEmitter from /Users/hello/Apps/Food/node_modules/react-native-viewport/Viewport.ios.js
Unable to resolve module NativeModules from /Users/hello/Apps/Food/node_modules/react-native-viewport/Viewport.ios.js
Unable to resolve module invariant from /Users/hello/Apps/Food/node_modules/react-native-viewport/Viewport.ios.js
Unable to resolve module ./base64-vlq from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./array-set from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./base64 from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/hello/Apps/Food/node_modules/react-native-viewport/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Hey Peter. Nice lib and great installation instructions!
I'm using iOS 8.3. iOS Simulator. On device rotations, it seems to work reliably with iPhone 6 and iPhone 6plus, but with other devices the callback isn't either reliably fired, or it's sent with the wrong dimension info (e.g. landscape dimensions sent when in Portrait, or portrait dimensions sent when in Landscape).
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.