If the user has enlarged the font in the phone settings, how can I deactivate this setting?
I know one way for React Native. I need a web code like this:
//Here is React-Native example
if (Text.defaultProps) {
Text.defaultProps.allowFontScaling = false
} else {
Text.defaultProps = {}
Text.defaultProps.allowFontScaling = false
}
i couldn't find anything when I searched for a draft similar to this.
any idea?
thanks for your time.
Greetings fellow humans,
I have a small problem with this little app that is just supposed to store and display data: https://snack.expo.dev/#vevlex/nullnotanobject
When I test this dircetly from my pc (I scan the QR code in my cmd window) on an ipad, the app boots fine but the data is not saved when re-running the app or when sending a job to another window (The "To Do" button on the right that shows up after you check a job).
When I run it from Expo, I get this error: null is not an object (evaluating 'jobs.map'
So I assume I'm doing something wrong with the saving / loading, or when actually writing the map, but I'm not sure, and I don't know how to approach this problem on my own.
Can anyone help me?
Please and thank you.
Update: var temp1 is not being set, as the alert here returns "Unidentified" even tho I just define it in the previous line. This only happens on iOS and android, it works fine on the web sim. Can anyone explain this?
<TextInput
style={s.jobInput}
onChange={(e) => {
var temp1 = e.target.value;
alert(temp1)
setJobs((currentJobs) =>
produce(currentJobs, (v) => {
v[index].address = temp1;
})
);
saveItem();
}}
value={j.address}
placeholder="Address"
/>
Ok after finding out what I stated in the update I searched a bit more and found out that on mobile you should use onChangeText rather than just onChange.
Expected outcome:
I was trying to to achieve this feature using storm react diagram. (click this link to show demo)
The Desired outcome:
convert the TypeScript to JavaScript should work, but it keep having error.
Problem:
however I ran into an error when converting this typescript to JavaScript (see below code block)
import * as SRD from 'storm-react-diagrams';
// setup diagram engine
this.engine = new SRD.DiagramEngine();
this.engine.installDefaultFactories();
//
const pathfinding = this.engine.getLinkFactories().getFactory<SRD.PathFindingLinkFactory>SRD.PathFindingLinkFactory.NAME;
What I have tried,
const pathfinding = this.engine.getLinkFactories().getFactory(PathFindingLinkFactory.NAME);
but I got this error instead
Full disclosure, I have posted this on GitHub too.
Solved.
const pathfinding = this.engine.getLinkFactories()[PathFindingLinkFactory.NAME];
I want to integrate survey-react (https://surveyjs.io/Examples/Builder/) in my project but I have a problem in the import of SurveyEditor.
var editor = new SurveyEditor.SurveyEditor("editorElement", editorOptions);
I get:
'SurveyEditor' is not defined no-undef
Can someone help me please in this problem?
I cant seem to be getting the #storybook addon knobs working? It doesnt seem to be decorating the actual story. Pretty much followed this
My code below.. Im using getstorybook with create-react-app
Using below packages:
#storybook/addon-actions": "^3.1.2,
#storybook/addon-info": "^3.1.4,
#storybook/addon-knobs": "^3.1.2,
#storybook/react": "^3.1.3
my setup
//.storybook/addons.js
import '#storybook/addon-knobs/register'
//.config
import { configure, setAddon, addDecorator } from '#storybook/react';
import infoAddon from '#storybook/addon-info';
setAddon(infoAddon);
function loadStories() {
require('../stories');
}
configure(loadStories, module);
//stories/index.js
import React from 'react';
import { withKnobs, text, boolean, number } from '#storybook/addon-knobs';
import { storiesOf } from '#storybook/react';
const stories = storiesOf('Storybook Knobs', module);
// Add the `withKnobs` decorator to add knobs support to your stories.
// You can also configure `withKnobs` as a global decorator.
stories.addDecorator(withKnobs);
// Knobs for React props
stories.add('with a button', () => (
<button disabled={boolean('Disabled', false)} >
{text('Label', 'Hello Button')}
</button>
))
This should be a no brainer, but no suck luck.
Hope this helps someone, but for some reason my addons panel suddenly disappeared from view and I couldn't figure out how to get it back. I could see the addons markup being rendered in the "elements" pane in my dev tools - so I knew things were working. Somehow storybook stored a bad value in my localStorage['storybook-layout'] so that the addons were positioned waaaaayyy off screen. Running the following fixed it.
localStorage.removeItem('storybook-layout')
You probably need to create the addons.js file on the storybook config folder. (By default .storybook).
Check the Docs for knobs you need to add the following:
import '#storybook/addon-knobs/register';
Hitting D on your keyboard toggles the layout // Ray Brown
or
You should also be able to expand the sidebar by clicking and dragging on the right side.
Try removing all the query string on the url
eg. http://localhost:6006/?knob-is_block=false&knob-Disabled=false&knob-disabled=false&knob-Style%20lite=false&knob-show=true&knob-Size=md&knob-readOnly=false&knob-Style=default&knob-icon%20name=vertical&knob-Label=Hello%20Button&knob-Active=false&knob-is_loading=false&selectedKind=Button&selectedStory=default%20style&full=0&addons=0&stories=1&panelRight=0&addonPanel=storybooks%2Fstorybook-addon-knobs
to http://localhost:6006
This worked for me.
In Storybook 6.5 I was facing the same issue after manually adding the addon:
npm i #storybook/addon-knobs --dev
All I needed to do is to go to the main.js file inside the .storybook folder and add the following:
"addons": ["#storybook/addon-knobs"]
Then I stopped the already running storybook in the terminal using ctrl/cmd + c and then re-run the storybook:
npm run storybook
Hope it helps. Thank you.